static void AddAllPrefabsUsedInCurrentSceneToList()
{
#if USE_PREFAB_USAGE_DETECTION_METHOD_B
AddAllPrefabsUsedInScene(EditorApplication.currentScene);
#else
GameObject[] allObjects = (GameObject[])UnityEngine.Object.FindObjectsOfType(typeof(GameObject));
for (int i=0; i<allObjects.Length; i++)
{
if (PrefabUtility.GetPrefabType(allObjects[i]) == PrefabType.PrefabInstance)
{
UnityEngine.Object GO_prefab = PrefabUtility.GetPrefabParent(allObjects[i]);
string prefabPath = AssetDatabase.GetAssetPath(GO_prefab);
//Debug.Log(" prefab: " + o.name + " path: " + AssetDatabase.GetAssetPath(o));
if (!_prefabsUsedInScenes.ContainsKey(prefabPath))
{
_prefabsUsedInScenes.Add(prefabPath, false);
}
}
}
/*
foreach(GameObject GO in allObjects)
{
if (PrefabUtility.GetPrefabType(GO) == PrefabType.PrefabInstance)
{
UnityEngine.Object GO_prefab = PrefabUtility.GetPrefabParent(GO);
string prefabPath = AssetDatabase.GetAssetPath(GO_prefab);
//Debug.Log(" prefab: " + o.name + " path: " + AssetDatabase.GetAssetPath(o));
if (!_prefabsUsedInScenes.ContainsKey(prefabPath))
{
_prefabsUsedInScenes.Add(prefabPath, false);
}
}
}*/
#endif
}