Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

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");
}
Source by hub.packtpub.com #
 
PREVIOUS NEXT
Tagged: #unity #string #array
ADD COMMENT
Topic
Name
1+5 =