- Home /
HideAndDontSave not preserve when creating Prefab
HideAndDontSave does not work when creating Prefab...
In Unity 4.5, I have a problem where a GameObject with the flags: HideAndDontSave shows up in the hierarchy.
I have an editor extension that allows to pick a component that can be dragged into the project panel to create a Prefab. The simplified code looks like so:
void CreateDragAndDrop(string new_object_name)
{
GameObject go= new GameObject(new_object_name);
go.hideFlags = HideFlags.HideAndDontSave;
DragAndDrop.PrepareStartDrag();
DragAndDrop.objectReferences= new UnityEngine.Object[1]{go};
DragAndDrop.StartDrag(new_object_name);
MemoryPool.DelayedDestroy(go); // This service will destroy the object after it is not used for a period of time.
}
In the Hierarchy...
When the drag is performed and ended inside the project panel, a Prefab is created but the GameObject is also visible in the hierarchy.
I can understand that the Prefab clones the 'go' but why does it now show in the hierarchy?
TAGS: Prefab, HideFlags, HideAndDontSave, DragAndDrop
NOTE: I had to put the TAGS in the text because the system does not allow me to create new tags and believe it or not Prefab does not exist; HideFlags does not exists; DragAndDrop does not exists ..... This is to wonder if we are in the Unity forum !!!
Same issue here.. is this a new problem in 4.5? Did you ever find a resolution? It seems to me this is a bug and should be reported to Unity.
Also, fixed your tags there. :) No idea what was up with that, they appeared fine for me.
@disruptive tags don't start with a capital letter if that's what you tried.
Still happening on Unity 2017, so necroposting is adecuate here.
Your answer
Follow this Question
Related Questions
Can't drag GameObject from Hiearchy to Project view to create prefabs on Linux unity 5.5.1 1 Answer
Why does my prefab create a child by itself in ProjectView 0 Answers
Script is being applied to each prefab instead of one 1 Answer
How To Make GUI/Dragable Object - Att: Video 3 Answers
prefab rendering on top of its parent? 0 Answers