Loading a different texture on multiple GUILayout buttons in custom editor inspector
Hello all,
I am making a custom editor and I want to have 3 separate textures (icon images) loaded on 3 separate GUILayout buttons, but struggling to do so. Let me explain: I am loading 3 prefabs from Resources/Prefabs folder and then I am assigning a GUILayout button for each prefab, just like this:
Object[] obj = Resources.LoadAll("Prefabs", typeof(GameObject));
objects = new GameObject[obj.Length];
for (int i = 0; i < obj.Length; i++)
{
objects[i] = (GameObject)obj[i];
}
if (objects != null)
{
for (int j = 0; j < obj.Length; j++)
{
if (GUILayout.Button("", GUILayout.Width(70), GUILayout.Height(70)))
{
selectedObject = objects[j];
}
}
}
How would I load separate textures for each button? Textures are located in Resources/Textures folder.
Thanks in advance!
Your answer
Follow this Question
Related Questions
Displaying multiple GUILayout button tooltips in a single GUILayout box? 1 Answer
get prefabs instantiated on specific texture 0 Answers
Prefabs not working after build 0 Answers
How do you get a color from another game object 1 Answer
Can I get a guide or link that might answer my question about swapping jerseys on a sports game 0 Answers