unity string array

207

unity string array -

// String array in Unity C#
string[] names = new string[] {"red", "green", "blue"};

// To use lists, make sure to have this at the beginning of your program
using System.Collections.Generic;

// To declare a new list
public List<string> listOfColours = new List<string>();

// To add elements to your list
void Start()
{
	listOfColours.Add("Red");
    listOfColours.Add("Green");
    listOfColours.Add("Blue");
}

Comments

Submit
0 Comments