public bool Initialize(UiInspector _rootHost, IUiInspector _host, object _hostTarget, TargetControl _control) { if (_rootHost == null || _host == null || _hostTarget == null || _control == null) { return(false); } // Set host hierarchy references: rootHost = _rootHost; host = _host; controlName = _control?.Name ?? "???"; // Make sure this type of control is only ever used to represent content accessors: if (_control.type != TargetControl.TCType.ContentAccessor) { Debug.LogError($"[UiControlContentAccessor] Error! This control can only represent members of target type 'ContentAccessor', found type '{_control.type}'!"); return(false); } accessor = _control.accessor; accessorSpec = _control.fieldInfo?.GetCustomAttribute <UiContentAccessorSpec>(); // Initialize local target controls for the accessor's 2 visible user-members and add the necessary bindings from text to content field: if (nameKey == null) { nameKey = new TargetControl(typeof(ContentAccessor).GetField("nameKey")); } if (nameKey.control == null) { nameKey.control = GetComponentInChildren <UiControlText>(true); } if (subInspector == null) { subInspector = new TargetControl(typeof(ContentAccessor).GetField("content")); } if (subInspector.control == null) { subInspector.control = GetComponentInChildren <UiControlSubInspector>(true); } // Update name key control and the subinspector: nameKey.control.controlName = _control.GetDisplayName(); nameKey.control.controlLevel = UiControlLevel.Detailed; nameKey.control.host = this; if (nameKey.control is UiControlText ctrlTxt) { ctrlTxt.isNameKeyField = true; } nameKey.AddContentBindingTarget(subInspector); nameKey.control.SetValue(accessor.nameKey); subInspector.control.controlName = _control.GetDisplayName(); subInspector.control.controlLevel = _control.setup.level; subInspector.control.host = this; if (DisplayContent) { (subInspector.control as UiControlSubInspector).Initialize(rootHost, this, ControlTarget, subInspector); subInspector.control.SetValue(accessor.content); } else { (subInspector.control as UiControl).gameObject.SetActive(false); } // Return success: UpdateContents(); return(true); }