Esempio n. 1
0
        private static void DrawObjectConstraint(Rect rect, ref VariableConstraint constraint)
        {
            if (!(constraint is ObjectVariableConstraint objectConstraint))
            {
                objectConstraint = new ObjectVariableConstraint {
                    Type = typeof(Object)
                };
                constraint = objectConstraint;
            }

            objectConstraint.Type = TypeDisplayDrawer.Draw <Object>(rect, GUIContent.none, objectConstraint.Type, false, true);
        }
Esempio n. 2
0
        private static VariableValue DrawObject(Rect rect, VariableValue value, ObjectVariableConstraint constraint)
        {
            var objectType  = constraint?.Type ?? value.ReferenceType ?? typeof(Object);
            var unityObject = value.Object;

            if (typeof(Component).IsAssignableFrom(objectType) || typeof(GameObject) == objectType || typeof(Object) == objectType)
            {
                unityObject = EditorGUI.ObjectField(rect, GUIContent.none, value.Object, objectType, true);
            }
            else
            {
                unityObject = AssetDisplayDrawer.Draw(rect, GUIContent.none, unityObject, objectType, true, true, AssetLocation.None, null);
            }

            return(VariableValue.Create(unityObject));
        }