Пример #1
0
        public static void AddTemplateLevel()
        {
            AddNewLevel();
            Object templateObject;                                            //Make an empty object to instantiate into so we can manipulate the empty objects name
            string clone = "(Clone)";                                         //String to replace

            Object[] template = Resources.LoadAll("Level Template");          //Load the clipboard
            for (int x = 0; x < template.Length; x++)                         //Loop through the clipboard
            {
                templateObject      = Instantiate(template[x]);               //Instantiate clipboard object
                templateObject.name = templateObject.name.Replace(clone, ""); //Replace (Clone) in the name with nothing
            }
            CreateNewLevel.SaveScene();
        }
Пример #2
0
        static void PasteAll()                                                  //Instantiate all objects in resource folder
        {
            GameObject clipboardObject;                                         //Make an empty object to instantiate into so we can manipulate the empty objects name
            string     clone = "(Clone)";                                       //String to replace

            Object[] clipboard = Resources.LoadAll("Clipboard");                //Load the clipboard
            for (int x = 0; x < clipboard.Length; x++)                          //Loop through the clipboard
            {
                clipboardObject      = Instantiate((GameObject)clipboard[x]);   //Instantiate clipboard object
                clipboardObject.name = clipboardObject.name.Replace(clone, ""); //Replace (Clone) in the name with nothing
                if (SelectionHandler.GetSelected() != null)
                {
                    clipboardObject.transform.parent = SelectionHandler.GetSelected().transform;
                }
            }
            CreateNewLevel.SaveScene();
        }