- Home /
Prefab GameObject's can not be made active!
Hi, I've just received this error, when trying to recursively set an object imported from max to false. I'm not quite sure I understand the error and there's been no mention on it in the forum before. Could anyone explain please? Thanks
Answer by Datael · Apr 18, 2012 at 08:42 AM
I know this is old but I just came across your question whilst looking for the answer to this problem myself... The problem was that you were trying to call SetActiveRecursively() on the prefab itself without instantiating it first.
If you use an object in the Hierarchy you won't run into this problem like you said in your own answer, but in most cases you don't want to instantiate from the Hierarchy like that if the object you're working with isn't constantly in the scene (say, for example, a submenu?).
Bottom line, if you're trying to SetActiveRecursively() something you're getting from a prefab, remember to instantiate it first.
Answer by AntLewis · Feb 20, 2012 at 05:37 PM
I think this wa because I was dragging the gameobject from the PROJECT folder and not the hierarchy, in case anyone is interested
Answer by Pangamini · Jan 07, 2013 at 05:01 PM
AFAIK even not instantiated prefabs (objects in the projects folder rather than in the scene hierarchy) are still valid GameObjects and can be performed most actions with. Not sure if they can be activated, though you can access its members, components, children etc. without instantiating it first.