I hope this isn’t a dumb question - but I am having trouble getting the length of an array of gameobjects using c#. The array is populated in the inspector. But for some reason objects.Length, objects.Size, and objects.Count do not work.
Thank you for any help!
public GameObject objects;
Do not work in what way? Because objects.Length is the way to do it.
If there are any errors they are likely interfering with expected results.
Length is a property, not a method, thus there are no parenthesis. In C# it’s capitalized:
int howMany = objects.Length;
In JS it’s low case:
var howMany = objects.length;
EDITED: JS actually accepts both, lowercase and uppercase (see the comments in this answer and in the others).