/// <summary> Creates a new instance of the drawer or returns a reusable instance from the pool. </summary> /// <param name="parent"> The parent drawer of the created drawer. Can be null. </param> /// <param name="label"> Label with the text to shown in the box. </param> /// <param name="messageType"> Type of the message. </param> /// <param name="readOnly"> True if control should be read only. </param> /// <returns> The instance, ready to be used. </returns> public static BoxDrawer Create(IParentDrawer parent, GUIContent label, MessageType messageType, bool readOnly) { BoxDrawer result; if (!DrawerPool.TryGet(out result)) { result = new BoxDrawer(); } result.Setup(label.text, null, parent, label, messageType, readOnly); result.LateSetup(); return(result); }
/// <inheritdoc/> protected override void DoBuildMembers() { if (parent == null) { return; } #if UNITY_EDITOR DrawerArrayPool.Resize(ref members, 2); var scriptReference = ScriptReferenceDrawer.Create(monoScript, this, monoScript != null); scriptReference.OnValueChanged += SetMonoScript; members[0] = scriptReference; int index = 1; #else int index = 0; #endif DrawerArrayPool.Resize(ref members, index + 1); members[index] = BoxDrawer.Create(this, GUIContentPool.Create(GetWarningMessage()), MessageType.Warning, ReadOnly); }