You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-06 12:20:30 +00:00
C#: Disallow init-only properties
ReadOnly properties are currently not allowed because the generated code needs to set them, this also apply to `init` properties because they need to be set after initialization.
This commit is contained in:
@@ -295,8 +295,8 @@ namespace Godot.SourceGenerators
|
||||
foreach (var property in properties)
|
||||
{
|
||||
// TODO: We should still restore read-only properties after reloading assembly. Two possible ways: reflection or turn RestoreGodotObjectData into a constructor overload.
|
||||
// Ignore properties without a getter or without a setter. Godot properties must be both readable and writable.
|
||||
if (property.IsWriteOnly || property.IsReadOnly)
|
||||
// Ignore properties without a getter, without a setter or with an init-only setter. Godot properties must be both readable and writable.
|
||||
if (property.IsWriteOnly || property.IsReadOnly || property.SetMethod!.IsInitOnly)
|
||||
continue;
|
||||
|
||||
var marshalType = MarshalUtils.ConvertManagedTypeToMarshalType(property.Type, typeCache);
|
||||
|
||||
Reference in New Issue
Block a user