瀏覽代碼

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.
Sai Nane 1 年之前
父節點
當前提交
15f6984675
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      doc/classes/Object.xml

+ 1 - 1
doc/classes/Object.xml

@@ -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;