Ejemplo n.º 1
0
        GameObject GetPrefab()
        {
            if (objectToPlace != null)
            {
                return(objectToPlace);
            }

            if (string.IsNullOrEmpty(prefabInfo.collection) || string.IsNullOrEmpty(prefabInfo.name))
            {
                return(null);
            }

            return(PrefabReferenceCollection.GetPrefabReference(prefabInfo));
        }
Ejemplo n.º 2
0
 public static void UpdateDynamicObjectReferencesInPrefabCollection(PrefabReferenceCollection refObj)
 {
     for (int i = 0; i < refObj.prefabs.Length; i++)
     {
         GameObject prefab = refObj.prefabs[i];
         if (prefab != null)
         {
             if (prefab.GetComponent <DynamicObject>() != null)
             {
                 // Modify prefab contents and save it back to the Prefab Asset
                 using (var scope = new EditPrefab(prefab)) {
                     scope.root.GetComponent <DynamicObject>().prefabRef = new PrefabReference(refObj.name, prefab.name);
                 }
             }
         }
     }
 }