Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C# readonly properties inaccessible from GDScript #67167

Closed
wscalf opened this issue Oct 10, 2022 · 0 comments · Fixed by #67304
Closed

C# readonly properties inaccessible from GDScript #67167

wscalf opened this issue Oct 10, 2022 · 0 comments · Fixed by #67304

Comments

@wscalf
Copy link
Contributor

wscalf commented Oct 10, 2022

Godot version

v4.0.beta2.mono.official

System information

Linux Mint 20.3 Cinnamon

Issue description

I have C#-defined resources that get injected as exports into GDScript, and while methods, signals, and read/write properties surface as expected, it looks like readonly properties are not. Trying to access them results in errors like: Invalid get index 'str2' (on base: 'Node2D (TestNode.cs)').

This looks likely related to the code generator. This screenshot from my sample project shows that the read/write property has 4 references (from generated code) while the readonly property has zero:
image

Steps to reproduce

  • Create a C# script that extends Resource or a node type. My actual project is using resources; the repro project extending Node2D
  • Add a readonly property (using getter or lambda syntax) to the C# script. Note the lack of references from generated code.
  • Create a GDScript with an export compatible with the C# script
  • Import the C# script to the GDScript
  • Try to access the readonly property from GDScript

Minimal reproduction project

ReadonlyPropertyRepro.zip

@akien-mga akien-mga added this to the 4.2 milestone Aug 28, 2023
Treer added a commit to Treer/WorldWanderer that referenced this issue Mar 20, 2024
…irror

Since godotengine/godot#67167 is complete but wasn't the only issue - I get the impression naked C# interfaces will never be GDscript-accessible, only GodotObject subclasses will be accessible in GDscript
Treer added a commit to Treer/WorldWanderer that referenced this issue Mar 20, 2024
…irror

Since godotengine/godot#67167 is complete but wasn't the only issue - I get the impression naked C# interfaces will never be GDscript-accessible, only GodotObject subclasses will be accessible in GDscript
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants