In the last lesson we linked our custom editor script with our test script.
In this lesson we are going to create some custom GUI elements.
So lets get started with that
1) Jump to the Editor Script and comment out the DrawDefaultInspector() so that we can start adding our own custom elements
Lets get started with introducing some GUI elements that we can create inside the inspector
The most basic one is a label
2) We will be using EditorGUILayout class to show our label inside the inspector.
This class has got tons of other types of functions which you can use
Goto this link and checkout the other functions available inside the EditorGUILayout class.
I would recommend to spend sometime on
those functions provided and try to implement all of those so that you can get an idea of how you can use different GUI elements to represent custom inspectors.
3) Now when we go back to unity we will see a label showing inside our inspector.
Now this concludes that we have a control over the inspector window.
4) Now lets add our public fields back to the inspector by using the EditorGUILayout class.
Write this code
Now go back to unity and you will notice that now both the public fields are now visible in the inspector window(Nothing Exciting Yet)
In the next lesson we will create some more GUI content which will help in improving the design of our custom inspector
In this lesson we are going to create some custom GUI elements.
So lets get started with that
1) Jump to the Editor Script and comment out the DrawDefaultInspector() so that we can start adding our own custom elements
Lets get started with introducing some GUI elements that we can create inside the inspector
The most basic one is a label
2) We will be using EditorGUILayout class to show our label inside the inspector.
This class has got tons of other types of functions which you can use
Goto this link and checkout the other functions available inside the EditorGUILayout class.
I would recommend to spend sometime on
those functions provided and try to implement all of those so that you can get an idea of how you can use different GUI elements to represent custom inspectors.
3) Now when we go back to unity we will see a label showing inside our inspector.
Now this concludes that we have a control over the inspector window.
4) Now lets add our public fields back to the inspector by using the EditorGUILayout class.
Write this code
Now go back to unity and you will notice that now both the public fields are now visible in the inspector window(Nothing Exciting Yet)
In the next lesson we will create some more GUI content which will help in improving the design of our custom inspector
No comments:
Post a Comment