Your other file doesn’t have an example variable so it should give a syntax error. If you use a global/autoload then you need to specify the global’s name then it’s property, even then on _ready() it may be a race condition
This is fine and sq_ready is accessable, but your _init function would freeze your game and I’m not sure what you want from it, the while true: will never end the frame. You are quite lucky sq_ready is false to start, can you explain what you intend to do and why you reached this _init conclusion?
_init will not do that, it runs for all objects before _ready(), it’s quite prone to causing issues instead of helping.
Instances are no different from nodes place in-editor, why do you want to run code only for instances? Could you share more about this problem? What specifically do you want to do for a “main object” that shouldn’t happen for instances? Are you duplicating the “main object”?
I want to be able to create copies of an object that can do things while the original is unaffected. The “main object” is the one that is being duplicated.
Then outside of specific resources that should be true, duplicates do not edit the original. You should mark any resources the original instance has “Local to Scene” to avoid them being shared among the copies. There are also some flags you could specify when duplicating
What specifically among your duplicates is being shared?
var clone = original.duplicate(Node.DUPLICATE_USE_INSTANTIATION)
add_sibling(clone)
I worded my answer wrong. Nothing is being shared among the duplicates. The methods being called in the duplicates are also running on the original, and many of said methods delete crucial parts of the object, such as a specific hitbox that needs to be deleted at a certain point.
Also, can we please go back to the initial problem of variable changes not registering across scenes?
When I run the code, it’s supposed to change sq_ready to true when the timer goes off, which it does, but that change doesn’t register anywhere else for some reason. It registers in varStor, but nowhere else.