public static ICollectionDrawer Create(Array value, LinkedMemberInfo memberInfo, [CanBeNull] IParentDrawer parent, GUIContent label, bool readOnly) { if (value == null) { #if DEV_MODE Debug.Assert(memberInfo != null, "Array.Create - both value and memberInfo null!"); #endif value = memberInfo.DefaultValue() as Array; if (value == null) { #if DEV_MODE Debug.LogError("Array.Create(" + memberInfo + ") of type " + StringUtils.ToString(memberInfo.Type) + ": value was null and memberInfo.DefaultValue() returned null!"); #endif return(null); } if (memberInfo.CanWrite) { memberInfo.SetValue(value); } } switch (value.Rank) { case 1: break; case 2: return(Array2DDrawer.Create(value, memberInfo, parent, label, readOnly)); case 3: return(Array3DDrawer.Create(value, memberInfo, parent, label, readOnly)); default: return(null); } ArrayDrawer result; if (!DrawerPool.TryGet(out result)) { result = new ArrayDrawer(); } result.Setup(value, DrawerUtility.GetType(memberInfo, value), 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); }