I’m trying to use the EditorGUI.IntPopup and the values i settled are shown, however when i choose a different value of the initial one, it doesn’t change at all
here’s the code
@CustomEditor (SpawnPoint)
class SpawnPointEditor extends Editor {
function OnInspectorGUI () {
var targetObject : SpawnPoint = target as SpawnPoint;
var rect : Rect = GUILayoutUtility.GetRect(1, 115);
EditorGUI.LabelField(rect, "\nFor Players, use ID:\nPLAYER FRONT LEFT = 0,\nPLAYER FRONT CENTER = 1,\nPLAYER FRONT RIGHT = 2,\nPLAYER BACK LEFT = 3,\nPLAYER BACK CENTER = 4,\nPLAYER BACK RIGHT = 5\n");
EditorGUILayout.Space();
var intPopRect : Rect = GUILayoutUtility.GetRect(1, 20);
var test : String[] = new String[3];
test[0] = "Valor 0";
test[1] = "Valor 1";
test[2] = "Valor 2";
var intTeste : int[] = new int[3];
intTeste[0] = 0;
intTeste[1] = 1;
intTeste[2] = 2;
targetObject.id = EditorGUI.IntPopup (intPopRect,"ID", 1, test, intTeste);
EditorGUILayout.Space();
DrawDefaultInspector();
} // OnInspectorGUI
} // class
any idea what am i doing wrong ?
---- EDIT ----
i love how things aways work out as soon as i post
well, i thought the “selectedValue” argument was just to set the value the popup was going to show on the begin, but its an argument to link the value that is going to be aways shown
so i changed the “1” to “targetObject.id” and everything worked how it was supposed to
line i changed → targetObject.id = EditorGUI.IntPopup (intPopRect,“ID”, 1, test, intTeste);