Open vvvvvvitor opened 2 months ago
This is due to cyclic dependencies and loading order. You want to have a constant in a class with instances of the same class, but this does not work as expected. If you move the constant to another class (ItemDB
), it will work. Also you can use a static variable instead of constant and load()
instead of preload()
, then it will work in the same class (Item
).
MRP: test-94242.zip
This is due to cyclic dependencies and loading order. You want to have a constant in a class with instances of the same class, but this does not work as expected. If you move the constant to another class (
ItemDB
), it will work. Also you can use a static variable instead of constant andload()
instead ofpreload()
, then it will work in the same class (Item
).MRP: test-94242.zip
Ah, I see, should I close this issue then?
I think no. Even if we don't support this case, it should probably produce an error since constants are evaluated at compile time.
Tested versions
System information
Godot v4.2.2.stable (15073afe3) - Freedesktop SDK 23.08 (Flatpak runtime) - Wayland - Vulkan (Forward+) - integrated Intel(R) UHD Graphics (ICL GT1) () - Intel(R) Core(TM) i3-1005G1 CPU @ 1.20GHz (4 Threads)
Issue description
When duplicating a saved resource, it's data seems to get lost.
The resource:
The code:
When trying to get the values from the resource it returns the values that were predefined, in this case, if I try to get the "name" property, it'll return "item" instead of "garden_key".
When also trying to access the data of the resource directly (load("path").property) I get an error that says the property does not exist, even though it should
Steps to reproduce
Minimal reproduction project (MRP)
N/A