Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

Objects with 'HideFlags.HideInHierarchy | HideFlags.NotEditable' are still editable

Discussion in 'Scripting' started by JoePatrick, Dec 8, 2018.

  1. JoePatrick

    JoePatrick

    Joined:
    Nov 3, 2013
    Posts:
    74
    So I have an object that I don't want to be visible and don't want to be editable so I am setting the HideFlags as shown below however it's not working. The object doesn't show in hierarchy as expected but I can still click on the actual object in the scene view and move it, delete it etc. Am I doing something wrong?


    beltParent = new GameObject("Belt");
    beltParent.hideFlags = HideFlags.HideInHierarchy | HideFlags.NotEditable;
     
  2. JoePatrick

    JoePatrick

    Joined:
    Nov 3, 2013
    Posts:
    74
    Ok, it turns out I was actually clicking on the child objects as I had not set their hide flags as well