How do you wait until a variable gets an expected value?
My current solution for my particular case is seen above, it waits one frame, but I find it a stupid solution as it offers 0 flexibility (and sometimes doesn’t work)
Essentially I have a ‘Player’ class that has an exported variable ‘entity_data’ which holds a resource that contains all entity data. I’m wanting to access a variable in player’s entity_data as soon as possible after loading the scene, so I want the script to wait till entity_data != null, but the below code doesn’t work for whatever reason
Is there some way I can do this within the ready function?
If you you filling entity_data during player initialization, @onready should be enough when referencing player. If this not work, you can try setters and getters.
But maybe i incorrectly interpreting your question.