My editor scripts create a prefab and then set it’s hideFlags to HideFlags.NotEditable, HideFlags.HideInInspector and HideFlags.HideInHierarchy.
Everything goes right until I save and reload my scene. The prefab do not have the hideFlags any more.
This is a bug or i need to set every time the hideFlags?
Hi @lassade! How are you setting the the hideFlags property? You need to make sure that it is properly dirtied and picked up as a change before you save the scene. One way is to do something like this:
using UnityEngine;
using UnityEditor;
public static void SetHideFlags (GameObject prefabInstances[], HideFlags flags) {
Undo.RecordObjects (prefabInstances, "Change Hide Flags");
foreach (GameObject instance in prefabInstances)
instance.hideFlags = flags;
}