/// <summary> Creates a new instance of the drawer or returns a reusable instance from the pool. </summary> /// <param name="value"> The starting cached value of the drawer. </param> /// <param name="memberInfo"> LinkedMemberInfo for the field, property or parameter that the drawer represents. Can be null. </param> /// <param name="parent"> The parent drawer of the created drawer. Can be null. </param> /// <param name="label"> The prefix label. </param> /// <param name="readOnly"> True if control should be read only. </param> /// <returns> The instance, ready to be used. </returns> public static ColorDrawer Create(Color value, LinkedMemberInfo memberInfo, IParentDrawer parent, GUIContent label, bool readOnly) { ColorDrawer result; if (!DrawerPool.TryGet(out result)) { result = new ColorDrawer(); } result.Setup(value, typeof(Color), memberInfo, parent, label, readOnly); result.LateSetup(); return(result); }
/// <inheritdoc/> protected override void DoBuildMembers() { #if UNITY_EDITOR Array.Resize(ref members, 3); #else Array.Resize(ref members, 2); #endif var first = Value; members[0] = ObjectReferenceDrawer.Create(first.background, memberBuildList[0], this, GUIContentPool.Create("Background"), false, false, false); int index = 1; #if UNITY_EDITOR //scaledBackgrounds field is not accessible from player code members[index] = ArrayDrawer.Create(first.scaledBackgrounds, memberBuildList[index], this, GUIContentPool.Create("Scaled Backgrounds"), false); index++; #endif members[index] = ColorDrawer.Create(first.textColor, memberBuildList[index], this, GUIContentPool.Create("Text Color"), false); }