Hi! I’m going to develop a static name picker (that means I’m not going to use any database because I DONT KNOW IF THAT’S POSSIBLE IN UNITY). Anyways, I don’t know how to print a random value from an array that I have declared. Does anybody know how to?
This is my code.
using UnityEngine;
using System.Collections;
public class Names : MonoBehaviour {
void Start()
{
string[] names = new string[3];
names[0] = "Jon";
names[1] = "Jen";
names[2] = "Jun";
//I need to randomly pick and print a value from this point.
print(names[0]);
}
}
I’m still testing stuff out so once I get it working on the console, I’ll implement them on a UI.
If someone has any better ideas, that would be great.