Disabling random GUI Button from array
I need help figuring out how to do it. Its supposed to get a random button, destroy it for the game and remove it from the array, thanks in advance
var n;
var kills;
var kill;
var VAT : GameManager = GetComponent(GameManager); //variable from another script that signals the AI's turn
var Cards : Array;
function VampireTurn () {
//This tells the AI if it can destroy a card or not
n = Random.Range (0, 2);
if(n==1){
kills === true;
}
//Part which i can't seem to figure out
if(kills === true){
Cards = GameObject.FindGameObjectsWithTag("Cards");
var i = Random.Range(0, Cards.lenght);
kill = Cards[i];
}
}
How would you do it? Please javascript since it has to reference other javascripts and C# would just destroy the balance of the universe and make the delivery date unachivable. THANKS FOR ANY HELP
Fairly urgent
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612042628im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Instantiated Buttons to have separate On-click functions 0 Answers
how to not repeat random array 1 Answer
C# Adding random values to array 1 Answer