Answer the question
In order to leave comments, you need to log in
Why does random selection of an element from an array not work?
Here is the code itself, it seems to include a random object, but for some reason, everything in turn
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class LevelPlay : MonoBehaviour
{
public bool isDead = false;
public GameObject[] OnButtons;
public bool IsStart = false;
IEnumerator LevelStart()
{
while (isDead == false)
{
yield return new WaitForSeconds(0.5f);
int rnd = Random.Range(0, 215);
OnButtons[rnd].SetActive(true);
}
}
private void Start()
{
StartCoroutine(LevelStart());
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question