public static PropertyDrawerDrawer Create(object value, UnityEditor.PropertyDrawer drawerInstance, Type drawerType, LinkedMemberInfo memberInfo, IParentDrawer parent, GUIContent label, bool setReadOnly) { if (memberInfo == null) { #if DEV_MODE Debug.LogError("PropertyDrawerDrawer.Create(drawerType=" + drawerType.Name + ", parent=" + StringUtils.ToString(parent) + ", label=" + (label == null ? "null" : label.text) + "), returning null because fieldInfo was null"); #endif return(null); } if (memberInfo.SerializedProperty == null) { #if DEV_MODE Debug.LogError("PropertyDrawerDrawer.Create(drawerType=" + drawerType.Name + ", parent=" + StringUtils.ToString(parent) + ", label=" + (label == null ? "null" : label.text) + "), returning null because fieldInfo.SerializedProperty was null"); #endif return(null); } PropertyDrawerDrawer result; if (!DrawerPool.TryGet(out result)) { result = new PropertyDrawerDrawer(); } result.Setup(value, drawerInstance, drawerType, memberInfo, parent, label, setReadOnly); result.LateSetup(); return(result); }
public static PropertyDrawerDrawer Create(object value, object attribute, Type drawerType, LinkedMemberInfo memberInfo, IParentDrawer parent, GUIContent label, bool readOnly) { if (memberInfo == null) { #if DEV_MODE Debug.LogError("PropertyDrawerDrawer.Create(drawerType=" + drawerType.Name + ", parent=" + StringUtils.ToString(parent) + ", label=" + (label == null ? "null" : label.text) + "), returning null because fieldInfo was null"); #endif return(null); } if (memberInfo.SerializedProperty == null) { #if DEV_MODE Debug.LogError("PropertyDrawerDrawer.Create(drawerType=" + drawerType.Name + ", parent=" + StringUtils.ToString(parent) + ", label=" + (label == null ? "null" : label.text) + "), returning null because fieldInfo.SerializedProperty was null"); #endif return(null); } UnityEditor.PropertyDrawer drawerInstance; try { drawerInstance = drawerType.CreateInstance() as UnityEditor.PropertyDrawer; } catch (Exception e) { Debug.LogError("Failed to create instance of PropertyDrawer " + StringUtils.ToString(drawerType) + " " + e); return(null); } PropertyDrawerDrawer result; if (!DrawerPool.TryGet(out result)) { result = new PropertyDrawerDrawer(); } result.Setup(value, attribute, drawerInstance, drawerType, memberInfo, parent, label, readOnly); result.LateSetup(); return(result); }