public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            VarComponent vc = (VarComponent)target;

            Type t = vc.compType != null?Type.GetType(vc.compType) : types[0];

            if (t == null)
            {
                t = types[0];
            }

            t           = types[EditorGUILayout.Popup("Component Type:", types.IndexOf(t), types.Select(x => x.Name).ToArray())];
            vc.compType = t.AssemblyQualifiedName;
        }
Пример #2
0
        public override Variable Duplicate(object varHolder)
        {
            if (isStatic)
            {
                if (value == null)
                {
                    value = ((Component)varHolder).GetComponent(GetVarType());
                }
                return(this);
            }

            VarComponent v = CreateInstance <VarComponent>();

            v.compType = compType;
            v.value    = ((Component)varHolder).GetComponent(GetVarType());
            return(v);
        }