I am trying to make an intager a random number between 1 and the length of a list
code can be found here:
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class GameControllerScript : MonoBehaviour {
public static List <int> Cards = new List <int>();
public int RndCard;
public static int CardNo;
public static bool Active = true;
void Start()
{
Cards.Add(1);
Cards.Add(2);
Cards.Add(3);
}
void Update()
{
print(Random.Range(1,Cards.Count));
if(Active == false)
{
Active = true;
RndCard = Random.Range(1,Cards.Count);
CardNo = Cards[RndCard];
Cards.RemoveAt(CardNo);
}
}
the print statement works but the "RndCard" variable dosent even though they are neer enough the same statement
Aucun commentaire:
Enregistrer un commentaire