public static void AddPrefab() { if (Editor.FindObjectOfType<CFGLoader>() == null) { UnityEngine.Object prefab = Resources.Load("Config"); var newObj = PrefabUtility.InstantiatePrefab(prefab); GameObject obj = (GameObject)newObj; manager = obj.GetComponent<CFGLoader>(); obj.name = "Config"; var core = GameObject.Find("Core"); if (core == null) { core = new GameObject(); core.name = "Core"; } obj.transform.SetParent(core.transform); } else { Debug.Log("There is already one Config Loader in this scene!"); } }
public override void OnInspectorGUI() { manager = (CFGLoader)target; DrawDefaultInspector(); if (manager.configFile != "" && manager.extension != "") { GUILayout.BeginHorizontal(); if (GUILayout.Button("Create base")) { CreateFileBase(); } if (GUILayout.Button("Create additional")) { CreateFileAdditional(); } if (manager.BaseFile != "") { if (GUILayout.Button("Pack base config")) { PackBaseFile(); } } GUILayout.EndHorizontal(); } }