Question by
jimjames · Dec 03, 2019 at 05:52 PM ·
listlistscustom editorgeneric
Editor with a generic list
Hi:
I am trying to make a custom editor window with a grneric list. the same as one in the inspector when you attach it on a gameobject.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
[System.Serializable]
public class Tile
{
public GameObject tile; //the tile prefab
public Color tileColor; //the reffrence of color to instantiate prefab
}
public class LevelGenerator : EditorWindow
{
public List<Tile> tileList;
[MenuItem("Window/My Editor/Level Generator")]
public static void ShowWindow()
{
GetWindow<LevelGenerator>("Level Generator");
}
//window code
void OnGUI()
{
tileList = EditorGUILayout.List<Tile>("Tile", tileList); //Having trouble with this part!!!
}
}
im thinking it has to do with "propertyfields" but having trouble implementing it.
Thanks: James
Comment
Your answer
Follow this Question
Related Questions
How can I check value stored in a list when pressing button with the same name? 2 Answers
Serializing a List of generic classes 0 Answers
Can Static classes have static lists? 1 Answer
How can I sort a list of GameObject by name? 1 Answer
How to know if a list contains GameObjects with a specific Varaible values ? 0 Answers