Array.size() not working on an array of Areas2D

Godot Version

Godot 4.1.2

Question

Hi.
I’m trying to make a loop, that would access each Area2D in an array generated by the Area2D.get_overlapping_areas() and trigger a function in each of them. To make the loop iterations adjust to the number of Areas in the array, I was trying to use the .size() to use as the limit for the loop. But the project crashes every time on the line trying to get that array’s size, with the error message being "Invalid get index ‘size’ (on base: ‘Array[Area2D]’). I’ve checked, and it’s definitely creating the array, and it’s not empty, as the game starts with one Area2D already overlapping, so the array starts out with values.

I’ve run out of ideas how to fix it, maybe the array generates empty for the first tick and that causes the issue, or maybe it’s not even an array, and it’s my mistake for assuming so

You forgot the parenthesis.

1 Like

Oh my god, I’m so dumb. Thank you for responding

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.