using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEditor; using UnityEditor.Scripting.Python; [CustomEditor(typeof(PyTool))] public class PyToolEditor : Editor { PyTool targetTool; private void OnEnable() { targetTool = (PyTool)target; } public override void OnInspectorGUI() { if (GUILayout.Button("PyTool", GUILayout.Height(35))) { Debug.Log("Hello PyTool"); string cur_path = Application.dataPath; Debug.Log(cur_path); string py_file = cur_path + "/PythonScript/UnityPythonRun.py"; Debug.Log(py_file); PythonRunner.RunFile(py_file); } if (GUILayout.Button("TestQ", GUILayout.Height(35))) { Debug.Log("Hello TestQ"); string cur_path = Application.dataPath; string py_file = cur_path + "/PythonScript/TestQ.py"; Debug.Log(py_file); PythonRunner.RunFile(py_file); } } }