Unity Editor 一、基本概念 1 SerializeField:Force Unity to serialize a private field.You will almost never need this. When Unity serializes your scripts, it will only serialize public fields. If in addition to that you also want Unity to serialize one of your private fields you can add the ...
field.SetValue(EditorGUILayout.ObjectField(field.Name, (UnityEngine.Object)field.GetValue(), field.GetPropertyType(),true, emptyOptions));break;default:break; } EditorGUILayout.EndHorizontal(); } EditorGUILayout.EndVertical(); } publicstaticPropertyField[] GetProperties(System.Object obj) { List<Pr...
using UnityEditor;[CustomEditor(typeof(DialogueSO))]publicclassDialogueSOEditor:Editor{ private DialogueSO _selectSO; privatebool_showDictionary =true; privatestring_statusStr ="节点字典"; privatevoidOnEnable(){ _selectSO = target as DialogueSO; } public overridevoidOnInspectorGUI(){ base.OnInspect...
GetAssetPath(tex); } EditorGUILayout.LabelField("资产路径是", path); 2. 加载资产 关键字: AssetDatabase.LoadAssetAtPath private string texPath = "Assets/MyShaders/Brick_Normal.JPG"; //定义好路径 private Texture myTex; //定义好对象 ... EditorGUILayout.LabelField("自定义文件路径", te...
{//窗口弹出时候调用Debug.Log("My Window Start");}voidUpdate(){//窗口弹出时候每帧调用Debug.Log("My Window Update");}[MenuItem("MyTools/GetItem")]staticvoidInit(){GetWindow(typeof(GetItemsTool));}voidOnGUI(){id=EditorGUILayout.IntField(id);if(GUILayout.Button("Get")){Debug.Log("...
unity-projectlist(from gamasutra) UnityEditor.Editor类 到目前为止,我设立的最普遍的定制是一个自定义检查器。Unity的Inspector面板提供看到组件状态的窗口,但是这种基本设置只能理解有限的类型,而且只能展示公共区域。 自定义检查器让你可以完全控制用户查看和编辑你的组件的方式。比如,它们可以让你呈现只读资产、强迫性...
EditorGUILayout.LabelField("Base Info"); player.id = EditorGUILayout.IntField("Player ID",player.id); player.playerName = EditorGUILayout.TextField("Player Name",player.playerName); SerializedProperty property = serializedObject.FindProperty("playerTransformList"); //獲取已經序列化的對象 ...
foreach(FieldInfofieldInfoinlistFieldInfo) { if(!fieldInfo.FieldType.IsValueType) { SearchProperties(fieldInfo.GetValue(null),assetPaths); } } if(assetPaths.Count>0) { StringBuildersb=newStringBuilder(); sb.AppendFormat("{0}.cs\n",type.ToString()); ...
using UnityEditor; using UnityEngine; using UnityEditorInternal; using System; using System.Linq; public class Test : MonoBehaviour { public List<string> list = new List<string>(); } [CustomEditor(typeof(Test))] public class TestEditor : Editor ...
(null!=obj){Dynamicbrowser=newDynamic(obj);if((int)browser.PrivateInstanceField("m_ViewMode")==1){browser.CallPrivateInstanceMethod("ShowObjectsInList",instanceIds);return;}}Selection.instanceIDs=instanceIds;// _staticBrowser.CallPrivateStaticMethod("ShowSelectedObjectsInLastInteractedProjectBrowser");...