So basically I am trying to choose a random material from an array of materials and for now just display which one is picked in the console. I know how to do this with gameObjects but not sure the right words to use when referencing materials rather than objects. I attached what I came up with. Thank you!
'using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class gameManager : MonoBehaviour {
public Material[] Mats;
GameObject currentMat;
int index;
// Use this for initialization
void Start ()
{
Mats = Material.FindObjectsOfType(Material);
index = Random.Range(0, Mats.Length);
currentMat = Mats[index];
Debug.Log(currentMat.name);
}
// Update is called once per frame
void Update () {
}
}
`