public static Texture2D GetIconForObject(GameObject obj)
 {
     if (_imp_getIconForObject == null)
     {
         _imp_getIconForObject = _accessWrapper.GetStaticMethod("GetIconForObject", typeof(System.Func <UnityEngine.Object, Texture2D>)) as System.Func <UnityEngine.Object, Texture2D>;
     }
     return(_imp_getIconForObject(obj));
 }
        //#######################
        // GetDrawerTypeForType

        public static System.Type GetDrawerTypeForType(System.Type tp)
        {
            if (_imp_getDrawerTypeForType == null)
            {
                _imp_getDrawerTypeForType = _accessWrapper.GetStaticMethod("GetDrawerTypeForType", typeof(System.Func <System.Type, System.Type>)) as System.Func <System.Type, System.Type>;
            }
            return(_imp_getDrawerTypeForType(tp));
        }
 public static float GetSinglePropertyHeight(SerializedProperty property, GUIContent label)
 {
     if (_imp_GetSinglePropertyHeight == null)
     {
         _imp_GetSinglePropertyHeight = _accessWrapper.GetStaticMethod("GetSinglePropertyHeight", typeof(System.Func <SerializedProperty, GUIContent, float>)) as System.Func <SerializedProperty, GUIContent, float>;
     }
     return(_imp_GetSinglePropertyHeight(property, label));
 }
 public static void SetIconForObject(GameObject go, Texture2D texture)
 {
     if (_imp_setIconForObject == null)
     {
         _imp_setIconForObject = _accessWrapper.GetStaticMethod("SetIconForObject", typeof(System.Action <UnityEngine.Object, Texture2D>)) as System.Action <UnityEngine.Object, Texture2D>;
     }
     _imp_setIconForObject(go, texture);
 }
        //#######################
        // GetDrawerTypeForType

        public static System.Type GetDrawerTypeForType(System.Type tp)
        {
            //HACK FIX FOR Vector2 AND Vector3
            if (tp == typeof(Vector2))
            {
                return(typeof(HackVector2PropertyDrawer));
            }
            else if (tp == typeof(Vector3))
            {
                return(typeof(HackVector3PropertyDrawer));
            }

            if (_imp_getDrawerTypeForType == null)
            {
                _imp_getDrawerTypeForType = _accessWrapper.GetStaticMethod("GetDrawerTypeForType", typeof(System.Func <System.Type, System.Type>)) as System.Func <System.Type, System.Type>;
            }
            return(_imp_getDrawerTypeForType(tp));
        }
Esempio n. 6
0
        public bool OnGUI(Rect position, SerializedProperty property, GUIContent label, bool includeChildren)
        {
            var drawer = this.GetDrawer(property);

            if (drawer != null)
            {
                EditorGUI.BeginChangeCheck();
                drawer.OnGUI(position, property, label);
                return(EditorGUI.EndChangeCheck());
            }
            else
            {
                if (_imp_DefaultPropertyField == null)
                {
                    _imp_DefaultPropertyField = _editorGuiAccessWrapper.GetStaticMethod("DefaultPropertyField", typeof(System.Func <Rect, SerializedProperty, GUIContent, bool>)) as System.Func <Rect, SerializedProperty, GUIContent, bool>;
                }
                return(_imp_DefaultPropertyField(position, property, label));
            }
        }