public override void OnInspectorGUI() { if (GUILayout.Button("Open Prop Tools")) { PropToolsWindow.ShowWindow(); } GUILayout.BeginHorizontal(); GUILayout.Label("File Path", colLabel); Target.filePath = GUILayout.TextField(Target.filePath, GUILayout.ExpandWidth(true)); if (GUILayout.Button("Set")) { string folderPath = EditorUtility.OpenFolderPanel("Select path", Target.filePath, ""); if (folderPath != null && folderPath != "") { Target.filePath = folderPath; } } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("File Name", colLabel); Target.filename = GUILayout.TextField(Target.filename); GUILayout.EndHorizontal(); if (GUILayout.Button("Write Config")) { WritePropConfig(); } // DrawDefaultInspector(); }
public static void ShowWindow() { window = (PropToolsWindow)EditorWindow.GetWindow(typeof(PropToolsWindow)); window.title = "Prop Tools"; window.minSize = new Vector2(300, 500); window.maxSize = new Vector2(300, 500); }
private void CheckGUISetup() { if (window == null) { window = this; } if (propTools == null) { propTools = (PropTools)FindObjectOfType(typeof(PropTools)); if (propTools == null) { GameObject newObject = new GameObject(); newObject.name = "PropTools"; newObject.transform.position = Vector3.zero; newObject.transform.rotation = Quaternion.identity; newObject.transform.localScale = Vector3.one; propTools = newObject.AddComponent<PropTools>(); } } }
private void CheckGUISetup() { if (window == null) { window = this; } if (propTools == null) { propTools = (PropTools)FindObjectOfType(typeof(PropTools)); if (propTools == null) { GameObject newObject = new GameObject(); newObject.name = "PropTools"; newObject.transform.position = Vector3.zero; newObject.transform.rotation = Quaternion.identity; newObject.transform.localScale = Vector3.one; propTools = newObject.AddComponent <PropTools>(); } } }