Hi all, I’m trying to make an editor tool… quite annoying to be honest. Don’t know much about them.
I have figured how to create a menu item and display a window when a link is created (Step 1 :3 ). Next I’m trying to load images from a folder in the project (Step 2) and display them in a grid. (Step 3)…
I have been stuck trying to just get an array with the data for quite a while.
public class ObjectManager : EditorWindow
{
int myInt = 1;
int[] arr1 = {1,2,3,4,5};
string[] arr2 = {"ab", "cd", "ef","gh","ij"};
Object txt = new Object();
bool RunOnce = true;
// Add menu to Window menu
[MenuItem ("Level Editor/Add Object")]
static void Init ()
{
// Get existing open window or if none, make a new one:
ObjectManager window = (ObjectManager)EditorWindow.GetWindow (typeof(ObjectManager));
window.title = "Object Manager";
}
void OnGUI ()
{
// if(GUI.Button(new Rect(0,0,200,100), "Get Info"))
// {
// txt = EditorGUIUtility.Load("Assets/Images/Planets");
// txt = Resources.LoadAll("Assets/Images/Planets");
// }
GUILayout.Label ("Base Settings", EditorStyles.boldLabel);
myInt = EditorGUILayout.IntPopup ("Level Number", myInt,arr2,arr1);
EditorGUILayout.BeginScrollView(new Vector2(0,0));
GUILayout.Label (txt.name, EditorStyles.boldLabel);
EditorGUILayout.EndScrollView();
}
}
Sooooo
- How do you load objects while in editor mode to an editor window?
Extra Credit: How could they be displayed in a grid?
Any tips to guide me are greatly appreciated