Hello, I just wanted to know how I can make it so that my script will pick a random wall and then AddComponent a script to it.
using UnityEngine;
using System.Collections;
public class CSpawner : MonoBehaviour {
GameObject[] Walls;
public int index;
// Use this for initialization
void Start () {
Walls = GameObject.FindGameObjectsWithTag("DestroyableWall");
Random.Range (0, Walls.Length);
// I want it to find a random wall, then Add a Component to that randomly selected wall.
}
// Update is called once per frame
void Update () {
}
}