public object GetValue() { object inputValueInstance = _fieldInfo.GetValue(_nodeEditorGUI.GetEditableObject()); if (inputValueInstance == null) { if (_fieldInfo.FieldType.IsValueType) { inputValueInstance = Activator.CreateInstance(_fieldInfo.FieldType); } else if (_fieldInfo.FieldType.IsClass) { ConstructorInfo constructor = _fieldInfo.FieldType.GetConstructor(Type.EmptyTypes); if (constructor != null) { inputValueInstance = constructor.Invoke(null); } else { throw new Exception("need a parameterless constructor"); } } } return(inputValueInstance); }
protected override void SetObjectPosition(SerializedObjectEditorGUI <Node> editorGUI, Vector2 position) { NodeEditorGUI nodeGUI = (NodeEditorGUI)editorGUI; nodeGUI.GetEditableObject()._editorPosition = position; nodeGUI.CalcBounds(_nodeTitleTextStyle, _nodeTextStyle, _currentZoom); }