I'm trying to use this to be able to interact with objects and characters in my game, but Godot is giving me this error and I'm not sure why.
Godot gives me error for trying to access a node from an array?
is this running in physics_process
? because that's the only place were you can interact with physics.
interact_areas
I think is okay, then you iterate through it.
for i in interact_areas:
what this does is iterate through the array and assign the current item to i
, so you can run code on every item of the array
var interact_area = interact_areas[i]
this part is pointless, redundant, as i
already contains what you want interact_area
to be.
you should also check if arrays contain items with:
if not my_array.is_empty():
and check if each item is valid, to prevent errors.