unity当检视面板属性变动时
监听检视面板属性变动,做一些特殊处理using UnityEditor;using UnityEngine;using UnityEngine.UI;public class mImage : Image{ private Sprite m_Value; GameObject Game;#if UNITY_EDITOR //当脚本被加载或检视面板属性被修改时调用 protected override void OnValidate() { base.OnValidate(); if (EditorApplication.isPlaying) return; if (this.sprite != null) { Debug.Log(this.sprite.name); } }#endif}public class test : MonoBehaviour{ void OnValidate() { }}
页:
[1]