public static void CreateNewIvyGameObject(IvyProfileAsset asset = null) { var newIvy = new GameObject("Ivy Group"); var newIvyScript = newIvy.AddComponent <IvyBehavior>(); if (asset != null) { newIvyScript.profileAsset = asset; } Selection.activeGameObject = newIvy; }
public static IvyProfileAsset CreateNewAsset(string path = "Assets/NewIvyProfile.asset") { if (path == "") { path = EditorUtility.SaveFilePanelInProject("Hedera: Create New Ivy Profile .asset file...", "NewIvyProfile.asset", "asset", "Choose where in your project to save the new ivy profile file."); } IvyProfileAsset asset = ScriptableObject.CreateInstance <IvyProfileAsset>(); AssetDatabase.CreateAsset(asset, path); AssetDatabase.SaveAssets(); asset.ivyProfile.branchMaterial = IvyCore.TryToFindDefaultBranchMaterial(); asset.ivyProfile.leafMaterial = IvyCore.TryToFindDefaultLeafMaterial(); EditorUtility.FocusProjectWindow(); Selection.activeObject = asset; return(asset); }