Exemplo n.º 1
0
        void DrawSpatialConstraint(SpatialConstraint constraint)
        {
            if (constraint == null)
            {
                return;
            }

            var editorTypes = ReflectionUtils.GetAllSubtypes(typeof(SpatialConstraintEditor), false);

            foreach (var editorType in editorTypes)
            {
                var editorAttribute = System.Attribute.GetCustomAttribute(editorType, typeof(ConstraintEditorAttribute)) as ConstraintEditorAttribute;
                if (editorAttribute != null)
                {
                    if (editorAttribute.constraintType == constraint.GetType())
                    {
                        var editor = ScriptableObject.CreateInstance(editorType) as SpatialConstraintEditor;
                        editor.DrawConstraintEditor(constraint);
                        ScriptableObject.DestroyImmediate(editor);
                        editor = null;
                        break;
                    }
                }
            }
        }