get lenght of list unity code example
Example 1: unity list length
public List<GameObject> gameObjects = new List<GameObject>();
void Start()
{
int listLength = gameObjects.Count;
}
Example 2: how to get the length list in c# unity
public List<Transform> items = new List<Transform>();
void Start()
{
print(items.Count);
items.Add(new Transform());
print(items.Count);
}
Example 3: unity get list length
public List<GameObject> gameObjects = new List<GameObject>();
void Update()
{
int listLength = gameObject.Count;
if(listLength >= 0)
Debug.Log("Do something");
else
Debug.Log("Do something else");
}