I'm working on an easy dice roll. All it is is getting a random number from the code and it will display on the screen the two numbers. I'm having trouble though. It is in C#
using UnityEngine;
using System.Collections;
public class Dice : MonoBehaviour {
public int dice1;
public int dice2;
private void RandomNumber()
{
//Get a random number for the dice.
Random RandomNumber = new Random();
dice1 = RandomNumber.Next(6);
//Show Dice 1
Debug.Log(dice1);
dice2 = RandomNumber.Next(6);
//Show Dice 2
Debug.Log(dice2);
}
}
.Next is underlined and it wont compile. Any suggestions on how to fix this?
Actually they don't. See the Random class docs on MSDN.
– Eric5h5