I’ve been down the rabbit hole and ready 10s of threads about this and still can’t fix it. Apologies because it seems like it should be really simple.
After a dialogic conversation, I want to toggle the visibility of an interaction prompt to true. In this case a Sprite2D called “defib_prompt” originally I had it in another scene but suspected that could cause the issue so moved it into the main scene. It’s a very small game so the clutter isn’t and issue.
The func works right up to printing “defib required!” then crashes and gives me
Invalid set index ‘visible’ (on base: ‘null instance’) with value of type ‘bool’.
From the countless threads I’ve read I understand this means that the Sprite2D node doesn’t exist at the time of execution but I’m struggling to translate that info into a solution.
help would be greatly appreciated, if you can ELI5 that would be even better.
It means that the node “%defib_prompt” is null, it can be for different problems. Try to debug your game while running in remote section, check is it really exist?
i don’t understand why it wouldn’t be in the scene. it’s there in the tree and on-screen when I run the game. there aren’t any scene loads or anything in between that would result in it being destroyed.
i moved the code into the script for the level and the visible is now working, however when it’s made visible it’s at the left most point of the level for some reason. At least I’m onto a different issue. Thanks.