您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
31 行
783 B
31 行
783 B
using UnityEngine;
|
|
using UnityEngine.Events;
|
|
|
|
#if UNITY_EDITOR
|
|
using UnityEditor;
|
|
using Cinemachine.Editor;
|
|
#endif
|
|
|
|
namespace Cinemachine.Examples
|
|
{
|
|
public class InvokeEventFromInspector : MonoBehaviour
|
|
{
|
|
public UnityEvent Event = new UnityEvent();
|
|
public void Invoke() { Event.Invoke(); }
|
|
}
|
|
|
|
#if UNITY_EDITOR
|
|
[CustomEditor(typeof(InvokeEventFromInspector))]
|
|
public class GenerateEventEditor : BaseEditor<InvokeEventFromInspector>
|
|
{
|
|
public override void OnInspectorGUI()
|
|
{
|
|
BeginInspector();
|
|
Rect rect = EditorGUILayout.GetControlRect(true);
|
|
if (GUI.Button(rect, "Invoke", "Button"))
|
|
Target.Invoke();
|
|
DrawRemainingPropertiesInInspector();
|
|
}
|
|
}
|
|
#endif
|
|
}
|