In this lesson we will work on organizing our GUI elements inside the inspector in a more visually appealing manner .
To start with lets wrap our code inside a container by using
EditorGUILayout.BeginHorizontal();
and every time you start with this you have to end the layout by using
EditorGUILayout.EndHorizontal();
Important: Make sure you keep a track of these
Here's the Code
You will notice that all of the GUI elements will align horizontally and some may even go out of the inspector window. However, this is not what we want.
We want our inspector window to look more visually attractive and easy to use. So in order to do that we will nest our container with a BeginVertical and EndVertical layout.
Here's how our code will look like
Notice i have added GUILayout.Space(10) to give some spacing from the margins as well as between the GUI elements.
This concludes the current lesson. In the next section we'll create some more interactive gui elements like buttons,sliders etc.
To start with lets wrap our code inside a container by using
EditorGUILayout.BeginHorizontal();
and every time you start with this you have to end the layout by using
EditorGUILayout.EndHorizontal();
Important: Make sure you keep a track of these
Here's the Code
You will notice that all of the GUI elements will align horizontally and some may even go out of the inspector window. However, this is not what we want.
We want our inspector window to look more visually attractive and easy to use. So in order to do that we will nest our container with a BeginVertical and EndVertical layout.
Here's how our code will look like
Notice i have added GUILayout.Space(10) to give some spacing from the margins as well as between the GUI elements.
This concludes the current lesson. In the next section we'll create some more interactive gui elements like buttons,sliders etc.
No comments:
Post a Comment