hmmm… this actually looks like an error in the docs… this line:
sizeMultiplier = EditorGUILayout.IntField("Number of clones:", clones);
should in fact be this line…
clones = EditorGUILayout.IntField("Number of clones:", clones);
for it to work as they claim it does…
As to your question, I think you do know how to get the values from the properties of that other object and you are struggling in how to display them in your intfield and update them whenever the value changes? If not, this piece will probably not help and I didn’t understand you…
The way the legacy GUI system and the editor GUI system (which uses the legacy GUI system) works is that OnGUI or OnInspectorGUI is called multiple times every frame with different events (it is called once per frame for layout, once per frame for repaint, and perhap a few extra times for events like mousedown,mouseup, keydown etc.). So it’s not a one time creating of UI elements, this piece of code get called by Unity a lot of times as if it was in an update loop on steroids
to get the current type you can check [Event][1].[current][2].[type][3]
EditorGUILayout.IntField returns the changed value (or the same if it didn’t change.
so in order to answer your question, to get the changed value, you simply say:
for(int i = 0; i < myList.Length; i++)
{
myList _= EditorGUILayout.IntField("Number " + i, myList*);*_
}
Here you set myList to the result of the IntField.
If you don’t want to set the property every time because you do something in the setter, you could use EditorGUI.[BeginchangeCheck][4]/EndChangeCheck like this:
EditorGUI.BeginChangeCheck();
int tempResult = EditorGUILayout.IntField("Number " + i, myList*);*
if (EditorGUI.EndChangeCheck())
{
myList = tempResult;
}
*[1]: http://docs.unity3d.com/ScriptReference/Event.html*_
[2]: http://docs.unity3d.com/ScriptReference/Event-current.html*_
_[3]: http://docs.unity3d.com/ScriptReference/Event-type.html*_
_*[4]: http://docs.unity3d.com/ScriptReference/EditorGUI.BeginChangeCheck.html*_