コード例 #1
0
ファイル: ConfigEditor.cs プロジェクト: ismslv/Unity_CFG
 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!");
     }
 }
コード例 #2
0
ファイル: ConfigEditor.cs プロジェクト: ismslv/Unity_CFG
 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();
     }
 }