private void addObjects(GameObject[] objList, GameEnum.PrefabEnum prefabEnum, ref LevelData level) { for (var i = 0; i < objList.Length; ++i) { //Only look for instances of prefabs if (PrefabAssetType.Model == PrefabUtility.GetPrefabAssetType(objList[i])) { var root = PrefabUtility.GetOutermostPrefabInstanceRoot(objList[i]); //Only add to list if its the root to make sure the same object is not added several times if (root == objList[i]) { Debug.Log("It's the Root"); level.AddNewPrefab(objList[i], prefabEnum); } else { Debug.Log("It's not the root, so we dont add it to list"); } } else { Debug.Log("NOT A PREFAB"); } } }