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(); }
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(); }
static void PasteNewLevel() //Copy clipboard { CreateNewLevel.AddNewLevel(); PasteAll(); }
static void ClearLevelTemplate() //Recursively delete level template folder { CreateNewLevel.ClearLevelTemplate(); AssetDatabase.Refresh(); }