Set a gameobject unselectable in hierarchy using script

There’s a hand icon next to every object in hierarchy that you can use to set that object as untouchable/unselectable.
How can I set an object as unselectable using editor scripts?

https://docs.unity3d.com/ScriptReference/SceneVisibilityManager.html

3 Likes