Hello,
I am creating a custom editor window in which I want the user to be able to populate.
The window currently looks like this (messy I know):
I want the user to be able to change to monoscript field from “PositionChange” to any other monoscript. The problem is that these object fields are clearly created in a loop - and if I put the object field with this code for example:
MonoScript transformationFunc = EditorGUILayout.ObjectField(transformationFunc, typeof(MonoScript), true) as MonoScript;
it won’t let the user change the field because every time the window is drawn in OnGUI() the field is instantiated again. I tried using a dictionary and create “empty” monoscript objects for every field I know will appear in the window, but the only way to retrieve a monoscript from that dictionary was via the method “TryGetValue”, and I couldn’t figure out how to make the monoscript field affect the dictionary field using that function.
Any suggestions on how to let the user succesfully change this field?
Thanks
p.s - the quantity and names of these fields of course are not known in advance because they depend on the prefab entered by the user (in the screenshot-Cylinder)