Hello,
Simple question : is there a way to distinguish a gameobject which is in the hierarchy with one from your project folder when using Resources.FindObjectOfTypeAll();
I am making a script to convert a scene for Windows Store, I need to get rid of gameobject in the scene which use Vuforia scripts (Vuforia is not compatible with Windows Store) Some of those GameObjects are inactives and I must use the Resources static method instead of the GameObject’s one.
The problem is that the vuforia gameobjects in the scene are prefab from the project and I can’t distinguish them by their name since they are the same (in fact, I even use the files names in the project to find them in the hierarchy).
Resources.FindObjectOfTypeAll() returns prefabs from the hierarchy and from the project!
When I display the InstanceID of gameobjects that I try to delete, the one from the hierarchy are over 9000 (WHAT?! NINE THOUSAND?!) when the one of the project are under 1000. I am wondering if this is a serious track. I read somewhere that instanciated gameobjects receive negative instanceID…
Well, actually it kinda works since trying to use Editor.DestroyImmediate throw an exception when used on a project gameobject…
But I’d like to make it cleaner.
Thank you!
[edit] Found a solution
If there is an Asset path, it comes from the project and I don’t want it.
string assetPath = AssetDatabase.GetAssetPath(l_go.transform.root.gameObject);
if (!string.IsNullOrEmpty(assetPath))
continue;