public void AssertValid() { if (this.data == null) { return; } if (this.data.GetType() != PropUtil.GetExpectedType(this.propType)) { throw new System.Exception($"For prop {this.labelForDisplay}, the type of the data ({this.data.GetType()}) did not match the expected ({PropUtil.GetDefaultValue(this.propType).GetType()})"); } }
public void SetData(object newData) { Debug.Assert(newData == null || newData.GetType() == PropUtil.GetExpectedType(this.propType)); if (System.Object.Equals(__data, newData)) // Object.equals supports nulls { return; } __data = newData; if (this.assigned == null) { // Util.LogWarning("This PropEditor is not meant to be changed! It did not come from an AssignedBehavior, but probably an UnassignedBehavior!"); } else { this.assigned.SetProperty(this.propDef.variableName, this); } }