array in c# unity
string[ ] familyMembers = new string[]{"John", "Amanda", "Chris", "Amber"} ;
string[ ] carsInTheGarage = new string[] {"VWPassat", "BMW"} ;
int[ ] doorNumbersOnMyStreet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 };
GameObject[ ] carsInTheScene = GameObject.FindGameObjectsWithTag("car");
4.13
8
new List();
Thank you!
8
0
3.57
7
using System.Collections.Generic;
Thank you!
7
0
3.5
4
using UnityEngine;
using System.Collections;
public class Arrays : MonoBehaviour
{
public GameObject[] players;
void Start ()
{
players = GameObject.FindGameObjectsWithTag("Player");
for(int i = 0; i < players.Length; i++)
{
Debug.Log("Player Number "+i+" is named "+players[i].name);
}
}
}
Thank you!
4
0
0
0
public string[] myArrayName = new string[4];
Thank you!
0
0
Are there any code examples left?
New code examples in category C#