using UnityEngine; using System.Collections; using UnityEditor; [CustomEditor( typeof( MessageLog ) )] public class MessageLogEditor : Editor { public override void OnInspectorGUI() { MessageLog msgLog = (MessageLog)target; msgLog.IsLogC2SMessage = EditorGUILayout.Toggle( "Print C2S message", msgLog.IsLogC2SMessage ); msgLog.IsLogS2CMessage = EditorGUILayout.Toggle( "Print S2C message", msgLog.IsLogS2CMessage );
// 保存上面Toggle设置值 if ( GUI.changed ) { EditorUtility.SetDirty( target ); } } }