i am currently trying to make a tower defense in godot.
Each one of my towers have a variable pointing to the enemy they're currently targeting. This is used to, for example, animate their bows towards the enemies.
However, when the target dies, and is freed from the scene tree, it causes the game to crash for trying to access its attributes, EVEN THOUGH i null-checked it just before
Here are the problematic lines :
if not target == null:
$BowAnchor.look_at(target.global_position)