Hey everyone! I’ve been running into a strange bug lately, maybe someone has seen something like it before.
In messing around with object hideFlags, (specifically NotEditable), I’ve managed to break the inspector. What appears is this:
What I expect is this:
It seems like toggling the hide flags on and off sometimes fixes the issue, but has anyone else run into this before and have a reliable fix?
Here is the code I’m using to do the toggle:
private static void ProjectWindowItem_OnGUI(string guid, Rect drawingRect) {
GameObject asset = (GameObject)AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath (guid), typeof(GameObject));
if (asset) {
if (PrefabEditor.IsEditing()) {
// Set the NotEditable flag. (| bitwise or)
asset.hideFlags = asset.hideFlags | HideFlags.NotEditable;
} else {
// Clear the NotEditable flag. (& bitwise and) (~ bitwise negate)
asset.hideFlags = asset.hideFlags & ~HideFlags.NotEditable;
}
}
}