How would you get the length on a Godot.Collections Array in C#?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By AlMoeSharpton86

I’ve been following this tutorial ( But I’m trying to convert the GDScript in the tutorial to a C# equivalent.

In the sections which use a path array variable, it uses a length property / method such as != 0.
But going through the Godot C# docs ( ) , and under the array section it does not seem to have an length propetry or method to use.

How would be able to overcome this? Should I use an normal C# array, as I’m storing Vector2 variables in my C# godot collections array of an Vector 2 type.

My declaration of the array is :

private Godot.Collections.Array path;


:bust_in_silhouette: Reply From: jgodfrey

According to your linked doc, it has a Count property. I assume that’s what you want. Though, it does feel odd for a C#-based array to not have a Length property…

Thanks jgodfrey. :slight_smile:

It is strange :slight_smile: My aim is to see if the array is not empty, would the count property suffice?

AlMoeSharpton86 | 2020-04-04 15:24

I don’ t have a Godot-mono instance in front of me ATM but I assume it should work…

jgodfrey | 2020-04-04 15:29

Thank you, I Believe it works.

AlMoeSharpton86 | 2020-04-04 15:58