示例#1
0
    public static void MethodPropertyField(this SerializedProperty _methodProperty, int _index = 0)
    {
        GetProperties(_methodProperty);

        EditorGUILayout.PropertyField(objectType);
        if (objectType.enumValueIndex == (int)MethodProperty.ObjectType.Assigned)
        {
            //game object to use
            var goLabel = "Add Game Object To Begin";
            if (go.objectReferenceValue)
            {
                goLabel = "Game Object";
            }
            go.objectReferenceValue = EditorGUILayout.ObjectField(goLabel, go.objectReferenceValue, typeof(GameObject), true);

            if (go.objectReferenceValue)
            {
                var tempGo = go.objectReferenceValue as GameObject;
                MethodPropertyWithoutGameObjectField(_methodProperty, tempGo);
            }
        }
        else
        {
            componentNames = ComponentDatabase.GetAllComponentNames(true);
            componentTypes = ComponentDatabase.GetAllComponentAssemblyNames(true);
            behaviour.IndexStringField(componentNames);
            var indexValue = behaviour.FindPropertyRelative("indexValue");

            MethodPropertyField(_methodProperty, System.Type.GetType(componentTypes[indexValue.intValue]));
        }
    }
    protected override void GetProperties()
    {
        base.GetProperties();
        behaviour = sourceRef.FindProperty("behaviour");
        method    = sourceRef.FindProperty("method");

        componentNames = ComponentDatabase.GetAllComponentNames(true);
        componentTypes = ComponentDatabase.GetAllComponentAssemblyNames(true);
    }