Beispiel #1
0
 public static void AttachSounds()
 {
     foreach(GameObject compact in EditorHelpers.ProcessPrefabList<GameObject>( Prefs.CompactPrefab("*") )) {
         using(TemporaryPrefabInstance tmp = new TemporaryPrefabInstance(compact)) {
             if (SetupSound( tmp.Instance as GameObject )) {
                 tmp.Commit();
             }
         }
     }
 }
Beispiel #2
0
    static void FindPrefabAndLookForSound(MenuCommand command)
    {
        Object compactFragment = command.context as SlideShow;
        using(TemporaryPrefabInstance tmp = new TemporaryPrefabInstance(compactFragment)) {
            GameObject root = tmp.Instance as GameObject;

            if (SetupSound(root))
                tmp.Commit();
        }
    }
Beispiel #3
0
    static void CopyBoxes()
    {
        foreach(Object o in Selection.objects) {
            ImportedCloud ic = null;
            Component comp = o as Component;
            GameObject go = o as GameObject;
            if (comp != null)
                ic = comp.GetComponent<ImportedCloud>();
            else if (go != null)
                ic = go.GetComponent<ImportedCloud>();

            if (ic == null)
                continue;

            Transform oldBoxes = ic.transform.FindChild("CutBoxes");

            if (oldBoxes != null && oldBoxes.childCount > 0) {
                // see if there is a new original without children...
                string newPath = Prefs.ImportedCloudPrefab( ic.name );
                if (File.Exists(newPath)) {
                    using( TemporaryPrefabInstance tmp = new TemporaryPrefabInstance(newPath) ) {
                        GameObject newGo = tmp.Instance as GameObject;
                        Transform newBoxes = newGo.transform.FindChild("CutBoxes");
                        if (newBoxes != null && newBoxes.childCount == 0) {
                            // clone the original boxes...
                            GameObject boxNodeClone = GameObject.Instantiate(oldBoxes.gameObject) as GameObject;
                            ProceduralUtils.InsertAtOrigin(boxNodeClone, newGo);
                            Object.DestroyImmediate(newBoxes.gameObject);
                            boxNodeClone.name = "CutBoxes"; // remove "(clone)" suffix
                            tmp.Commit();
                        }
                    }
                }
            }
        }
    }