通过声明的变量名称,主动关联引用.
使用这个关联引用两种方式
1. 给你组件继承 MonoAutoQuote 点击组件inspector 按钮执行
2. 给你组件类添加[AAutoQuote] 特性 通过Plateface/SetSelectGameRef 执行
[AAutoQuote]public class MonoAutoQuote : MonoBehaviour ,IAutoQuote{}
public interface IAutoQuote { }
public class AAutoQuote : Attribute {}
using System.Collections;using System.Collections.Generic;using UnityEngine;using UnityEditor;using System.Reflection;
//[CanEditMultipleObjects]
[CustomEditor(typeof(MonoAutoQuote), true)]public class AutoQuoteEditor : Editor
{
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
if (GUILayout.Button("关联子节点引用"))
{
Component c = target as Component;
if (c != null)
AutioQuoteMenu.SetRef(c, c.gameObject);