I'm working on a small project currently, and I've encountered something strange while working with some old code. In the following function, "state" is returned as null:
func _process(_delta):
if state == 0:
rotation_degrees = 180
elif state == 1:
if get_owner().get_node("TankAI").searchray.position != null:
look_at(get_owner().get_node("TankAI").searchray.position)
elif state == 3:
if get_owner().get_node("TankAI").ray.position != null:
look_at(get_owner().get_node("TankAI").ray.position)
Now I'm calling for "state" as such:
onready var state = get_owner().get_node("TankAI/State-machine").state
In the "state machine"-node, "state" is assigned a value (it's an array), but it doesn't translate over. Calling for a different variable "states", returns values correctly (it's a dictionary).
Why is it returning null? It's not even giving an error.