- Home /
Working with the editor Selection
Hey all, I'm putting together a level editor within UnityEditor. This involves a lot of manipulations of the Selection, but the doc is barely existent and I can't seem to get it to do what I want.
More precisely : from within a CustomEditor class's OnSceneGUI(), I'm trying to change the current selection by changing the Selection.objects array. Modifying the referenced objects within that array seems to work, but changing the number of elements (by reassigning Selection.objects = new Object[10] for instance) does not. Does anybody have some pointers on how to correctly change the Selection objects ? Is it even supposed to work from within a CustomEditor.OnSceneGUI, since this is called on the selected objects anyway ?
Thanks a lot, Ben
Additionally, the doc for Selection.objects ( http://unity3d.com/support/documentation/ScriptReference/Selection-objects.html ) says it only holds scene/hierarchy objects, but it does actually return objects from the project also...
Continuing with my experiments: it seems modifying the Selection.objects DOES work fine as long as I'm not doing it during a "left-mouse-clic + control" event. Weird.
Your answer