private void CreateSubfieldsView(SerializedProperty serializedProperty) { var value = GetTargetObjectValue(); if (value == null) { FieldsContainer.Add(FieldUtility.NoneLabel); return; } var subInfos = value.GetType().GetSerializedFieldsUpToBase(); for (int i = 0; i < subInfos.Length; i++) { var subProp = subInfos[i]; var property = serializedProperty.FindPropertyRelative(subProp.Name); var subField = new PropertyFieldElement(); subField.HideUnsupported = HideUnsupported; subField.SetProperty(property); if (HideUnsupported && subField.SubfieldsCount == 0) { continue; } AddSubfield(subField); } }
private void TreeSelectorTreeChanged(BehaviourTree newTree) { if (_bbContainer.childCount > 0) { _bbContainer.Clear(); } if (newTree != null && newTree.Blackboard != null) { var blackboard = newTree.Blackboard; var serializedObject = new SerializedObject(blackboard); var property = serializedObject.GetIterator(); if (!property.Next(true)) { return; } property = property.Copy(); //Skipping Script reference property.NextVisible(false); while (property.NextVisible(false)) { var field = new PropertyFieldElement(); field.SetProperty(property); _bbContainer.Add(field); } } }
private void CreatePropertyField() { using (var sObject = new SerializedObject(Tree)) { using (var sProp = GetValueProperty(sObject)) { if (sProp != null) { _field = new PropertyFieldElement(); _field.SetProperty(sProp, true); var port = outputContainer.Q <Port>(); var container = port.Q <Label>().parent; container.Add(_field); port.style.height = new StyleLength(StyleKeyword.Auto); port.portName = " "; _field.OnChanged += SetDirty; } } } }
private bool CreatePropertyField() { var property = CreateOrGetTaskProperty(); if (property == null) { return(false); } property = property.Copy(); _field = new PropertyFieldElement(); _field.HideUnsupported = true; _field.SetProperty(property, true); if (_field.SubfieldsCount != 0) { _field.OnChanged += FieldChanged; Add(_field); return(true); } return(false); }