Unity中,保存在OnInspectorGUI中改变的值


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 ); } } }

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM