Set Selection.activeGameObject C#

Hi All,

I’m attempting to set a game object to be the UnityEditor.Selection.activeGameObject inside of the MonoBehaviour.OnDrawGizmos() method. It works for a frame and then immediately deselects the gameObject.

I have also tried Selection.activeTransform = transform and even copying the Selection.objects array and adding one more Object and reassigning it, to no avail.

Any insight?


Selection.activeGameObject is apparently only thought as a ‘GET’ from Unity Developers - There’s also multiple issues with the two-rows project window when trying to use it as ‘SET’.

I’m trying hard to convince them that there’s a strong need to set it - so far no luck. (It CAN be used to set, but it’s very buggy in actual use from EditorWindow)