A plugin for Unity that helps you write your own custom editors.
To install this plugin follow the instructions below. Make sure you have installed all required packages.
- Unity v. 2020 or newer
Import all repository files to your Assets
folder. Only folder called Examples
is unnecessary.
This plugin contains 2 classes:
ExtendedEditor.cs
- All editor functionsExtendedStyle.cs
- Style class for editor elements
Text
Example of using Text:ExtendedEditor.Text("Example Text");
Button
Example of using Button:if(ExtendedEditor.Button("Example Button"))
{
// What happens when the button is clicked
}
Image
Example of using Image:ExtendedEditor.Image(Resources.Load<Texture>("Textures/Example Image"));
Space
Example of using Space:ExtendedEditor.Space(10);
Divider
Example of using Divider:ExtendedEditor.Divider(5);
Menu
Example of using Menu:int selectedMenu = 0;
void OnGUI()
{
ExtendedEditor.Menu(ref selectedMenu, new string[] { "Tab 1", "Tab 2", "Tab 3" } );
switch (selectedMenu)
{
case 0:
// Page 1
break;
case 1:
// Page 2
break;
case 2:
// Page 3
break;
}
}
Layouts
Example of using HorizontalLayout:ExtendedEditor.HorizontalLayout(() =>
{
// code
});
Example of using VerticalLayout:
ExtendedEditor.VerticalLayout(() =>
{
// code
});
Example of using AreaLayout:
ExtendedEditor.AreaLayout(new Rect(0, 0, 350, 250), () =>
{
// code
});
Fields
Example of using ObjectField:GameObject obj;
void OnGUI()
{
obj = (GameObject)ExtendedEditor.ObjectField(new Rect(0, 0, 100, 35), obj, typeof(GameObject), false);
}
Example of using TextField:
string text;
void OnGUI()
{
ExtendedEditor.TextField(new Rect(0, 0, 100, 35), ref text);
}
This plugin is made by Polish Coder