Random One True Bool

public SearchObjects searchables;
private int randomNumber;
private bool keySpawned;

// Use this for initialization
void Awake () {
	GameObject[] searchable = GameObject.FindGameObjectsWithTag ("Searchable");
	searchables = new SearchObjects[searchable.Length];

	for (int i = 0; i < searchable.Length; i++) {
		searchables  _= searchable *.GetComponent<SearchObjects> ();*_

* randomNumber = Random.Range (0, 10);*
* if (randomNumber < 3) {*
_ searchable .GetComponent ().hasWard = true;
* } else {
searchable .GetComponent ().hasWard = false;

* // Update is called once per frame*
* void Update () {*
* }*
im hoping to make inside this loop for a true to come out of it in a random area! it will be the level key! players will have to search for it while avoiding a monster! i need the “keySpawned” bool to be true in a random game object

never mind i solved it
if (i == randomInt) {
searchable .GetComponent ().isKey = true;

  •   	} else {*

_ searchable .GetComponent ().isKey = false;_
* }*

I absolutely do not understand what you want to make. Could you please describe the task in a greater extent? What is this code about? Is this an actual search object or it is just a “manager”?

According to you, you want to make a bool “keySpawned” to be true in a random game object. If I understand your code correctly, then you have an array of all those objects that contains this bool variable. To embody your task, I would make a random number with the range of 0 to amount of the objects. Afterwards, just choose the object in an array with this index and set up keySpawned there to true.