Closed chrisl8 closed 2 months ago
@onready
doesn't help?
@AThousandShips @onready
prevents the error the first time a truck is selected, but if I use the "Back" button (upper left corner" and select a different truck, the error still happens then on each subsequent truck selection.
Never mind, I should have re-tested before replying. I'm sure that was the case yesterday, but today @onready
fixes it entirely. I will do that instead.
Upon starting the project and selecting a truck, this error is always emitted:
This also happens if you go back and pick a different truck.
I believe this is caused by attempting to assign
global_position
to a variable before the scene has initialized.Waiting until the
_ready()
function to assign the variable for the first time appears to solve this issue.Other fixes I tried fixed the initial error, but the error persisted if you went "Back" and selected a different truck. This fix covers that case too.