You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
Allow readonly and writeonly C# properties to be accessed from GDScript
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
namespace Godot.SourceGenerators.Sample
|
||||
{
|
||||
public partial class AllReadOnly : GodotObject
|
||||
{
|
||||
public readonly string readonly_field = "foo";
|
||||
public string readonly_auto_property { get; } = "foo";
|
||||
public string readonly_property { get => "foo"; }
|
||||
public string initonly_auto_property { get; init; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using System;
|
||||
|
||||
namespace Godot.SourceGenerators.Sample
|
||||
{
|
||||
public partial class AllWriteOnly : GodotObject
|
||||
{
|
||||
bool writeonly_backing_field = false;
|
||||
public bool writeonly_property { set => writeonly_backing_field = value; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace Godot.SourceGenerators.Sample
|
||||
{
|
||||
public partial class MixedReadonlyWriteOnly : GodotObject
|
||||
{
|
||||
public readonly string readonly_field = "foo";
|
||||
public string readonly_auto_property { get; } = "foo";
|
||||
public string readonly_property { get => "foo"; }
|
||||
public string initonly_auto_property { get; init; }
|
||||
|
||||
bool writeonly_backing_field = false;
|
||||
public bool writeonly_property { set => writeonly_backing_field = value; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user