Hello,
I have been running into an error, which I don't understand. It crashes my game and it looks like it happens when I try to set the position of an object that is not there. However, before setting the position, I check if the object is there.
func _process(delta):
if carried_object:
carried_object.position = position + $Body.position + Body/CarryPosition.position
The error occurs when I try to set the position of carried_object
, and the debugger marks the variable as unoccupied. However, shouldn't the line, if carried_object:
prevent this from happening? I assign carried_object
a value in _physics_process
.
I hope you can help me. Thanks :-)