dimanche 5 juillet 2020

how to pick random index out of array? [duplicate]

hi im very new to c# im coding on unity and trying to make games I wanted to try and pick a random index out of an array and my code works but I am not achieving the results that I want here is my code

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;

    public class gaogoaogag : MonoBehaviour
    {
        int[]gobbagoolios = { 56 , 97 , 57 };
        void Update() 
        {
           print(Random.Range(gobbagoolios[0], gobbagoolios.Length));        
        }        
   }

and here are the results in console a bunch of random error messages in console




Aucun commentaire:

Enregistrer un commentaire