CS1061 'Array<Node>' does not contain a definition for 'Size'

Godot Version

4.2

Question

Hello,

I am trying to write a C# script to count the remaining nodes of a group, but I cannot find Array.Size().
The IDE throws and error:

CS1061 'Array<Node>' does not contain a definition for 'Size' and no accessible extension method 'Size' accepting a first argument of type 'Array<Node>' could be found (are you missing a using directive or an assembly reference?)

Here is the code logic:

public override void _Process(double delta)
{
    if (gameRunning && (GetTree().GetNodesInGroup("enemies").Size() == 0))
    {
          //do something
    }
}

What can be causing this? Am I missing anything obvious?
I see that IDE finds the Resize() method, but not Size().

Try Count

1 Like

Thanks, using Count works.
Good link to the documentation.

1 Like

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