public static void CreateUIBase() { CreateOriginIfNull(); CopyAsset.CopyNewAsset(newScriptName, originScriptPathWithNameSpace); EditorPrefs.SetBool(key, true); }
public override void OnInspectorGUI() { if (_scriptCreater == null) { _scriptCreater = this.target as ScriptCreater; } _scriptCreater = this.target as ScriptCreater; this.Space(10) .ETextField("Script Name", ref _scriptCreater.ScriptName) .Pan(() => { if (!_scriptCreater.ScriptName.IsLegalFieldName()) { _scriptCreater.ScriptName = _scriptCreater.name.Replace(" ", "").Replace("(", "").Replace(")", ""); } }) .Label("Description") .TextArea(ref _scriptCreater.description, GUILayout.Height(40)) .Space(10) .DrawHorizontal(() => { GUILayout.Label(new GUIContent("Create Path:", "Drag Floder To Box")); Rect rect = EditorGUILayout.GetControlRect(); rect.DrawOutLine(2, Color.black); EditorGUI.LabelField(rect, _scriptCreater.CreatePath); if (!rect.Contains(Event.current.mousePosition)) { return; } var info = EditorTools.DragAndDropTool.Drag(Event.current, rect); if (info.paths.Length > 0 && info.compelete && info.enterArera && info.paths[0].IsDirectory()) { _scriptCreater.CreatePath = info.paths[0]; } }) .Space(10) .DrawHorizontal(() => { if (GUILayout.Button("Build", GUILayout.Height(25))) { if (BuildCheck()) { Selection.objects = new Object[] { AssetDatabase.LoadAssetAtPath <Object>(_scriptCreater.CreatePath) }; CopyAsset.Copy(_scriptCreater.ScriptName.Append(".cs"), originScriptPath); } } if (GUILayout.Button("Remove", GUILayout.Height(25))) { _scriptCreater.GetComponentsInChildren <ScriptMark>(true).ToList().ForEach((sm) => { DestroyImmediate(sm); }); DestroyImmediate(_scriptCreater); } }); try { serializedObject.Update(); } catch (Exception) { } }
public static void Create() { CreateOriginIfNull(); CopyAsset.Copy(newScriptName, originScriptPath); EditorPrefs.SetBool(key, true); }