You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you try to access static variables in @tool mode. The Godot editor crashes without any logs or messages
Steps to reproduce
Create two files as given below:
# Scene file@toolextendsNode2D@exportvarsetup: bool=false:
set(value):
setup=valueprint(Fluid.KIND[12]) # Cause of crash as KIND is null# Fluid File (Note: No @tool annotation)class_nameFluidstaticvarKIND:= {12: "River" }
When you toggle the setup Godot will crash as it will try to print static variable.
It should print error message like Invalid get index '12' (on base: 'Nil'). rather than crashing
If you add @tool annotation it does not crash and gives the right values
Minimal reproduction project (MRP)
If required will be provided
The text was updated successfully, but these errors were encountered:
If you add @tool to the preloaded script it will work. We have some inconsistency here: in some cases @tool is optional to run dependency code, in other cases it is required (usually Nodes, but in some other cases too, example). I'm not sure if this is a bug as it prevents non-@tool code from being auto-executed.
While crashing is still (absolutely) a bug, should GDScript instead throw an error about not being able to depend on static variables from other non-tool scripts in a tool script?
If you add @tool to the preloaded script it will work. We have some inconsistency here: in some cases @tool is optional to run dependency code, in other cases it is required (usually Nodes, but in some other cases too, example). I'm not sure if this is a bug as it prevents non-@tool code from being auto-executed.
While crashing is still (absolutely) a bug, should GDScript instead throw an error about not being able to depend on static variables from other non-tool scripts in a tool script?
Tested versions
Reproducible in
System information
Windows 11
Issue description
When you try to access static variables in
@tool
mode. The Godot editor crashes without any logs or messagesSteps to reproduce
Create two files as given below:
When you toggle the setup Godot will crash as it will try to print static variable.
It should print error message like
Invalid get index '12' (on base: 'Nil').
rather than crashingIf you add
@tool
annotation it does not crash and gives the right valuesMinimal reproduction project (MRP)
If required will be provided
The text was updated successfully, but these errors were encountered: