|
I have a a list of objects via Resources.FindObjectsOfTypeAll. I want to know who are Prefabs and who are on scene.
(comments are locked)
|
|
In the editor, use PrefabUtility.GetPrefabParent(theGO); ( http://unity3d.com/support/documentation/ScriptReference/PrefabUtility.html ) if you have a game object At runtime you can't find it out any longer and its not needed cause you can not create or modify them anyway Alternatively, don't use this function to get the resources but specific type ones. Anything thats a texture, mesh, audio or movie file is never a prefab, anything else so all component / monobehaviours are always prefabs as they can't exist in resources otherwise Just for completeness Thanks.
Feb 23 '12 at 12:50 AM
Veehmot
"At runtime you can't find it out any longer and its not needed cause you can not create or modify them anyway" I don't think this is true, at least any more. I've run into the exact same problem as the OP. I need to find all cameras in the scene active or inactive and make changes to them. Using FindObjectsOfTypeAll it also finds the prefabs. When I make modifications during runtime like this then stop the player, those changes persist in the Prefab :O
Mar 14 at 01:06 PM
xpation
(comments are locked)
|
