Fix check in `Object._ValidateProperty` example
The GDScript version above makes the `number` property read only whenever `is_number_editable` is false. ```gdscript func _validate_property(property: Dictionary): if property.name == "number" and not is_number_editable: property.usage |= PROPERTY_USAGE_READ_ONLY ``` The C# version is similar, but omits the negation, so the Number property is made read only whenever `is_number_editable` is true. This adds the negation to the C# example, making it match the GDScript example.
This commit is contained in:
parent
c73ac74c4a
commit
15f6984675
|
@ -341,7 +341,7 @@
|
|||
|
||||
public override void _ValidateProperty(Godot.Collections.Dictionary property)
|
||||
{
|
||||
if (property["name"].AsStringName() == PropertyName.Number && IsNumberEditable)
|
||||
if (property["name"].AsStringName() == PropertyName.Number && !IsNumberEditable)
|
||||
{
|
||||
var usage = property["usage"].As<PropertyUsageFlags>() | PropertyUsageFlags.ReadOnly;
|
||||
property["usage"] = (int)usage;
|
||||
|
|
Loading…
Reference in New Issue