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

Exported properties with default values in custom resources aren't correctly assigned null values #93495

Open
artmouse155 opened this issue Jun 23, 2024 · 0 comments

Comments

@artmouse155
Copy link

artmouse155 commented Jun 23, 2024

Tested versions

Reproducible in 4.2.1.stable [b09f793]

System information

Godot v4.2.1.stable - Windows 10.0.26120 - Vulkan (Mobile) - integrated Intel(R) Iris(R) Plus Graphics () - Intel(R) Core(TM) i7-1065G7 CPU @ 1.30GHz (8 Threads)

Issue description

Here, I have a custom resource that has a default value in code, but I want to assign a null value using the editor. I noticed that when I tried to set the exported property of my custom resource to <empty> that, upon viewing with the debugger, the property value had reverted back to the default value at runtime. I would expect the value to be null at runtime.
image
image
It seems like Godot reads properties in custom resources as the default properties of the resources. This seems to conflict with the behavior of native Godot classes, which read <empty> values set in the inspector as null values.

Steps to reproduce

  • Open the Minimal reproduction project
  • Place a breakpoint at line 8 in main.gd
  • Run the project, it should reach the breakpoint
  • Inspect the value of stack variable invisible_weapon
  • Note how invisible_weapon's weapon_icon property is not null as expected

Minimal reproduction project (MRP)

MRP.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: For team assessment
Development

No branches or pull requests

2 participants