You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
435 B

  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class SetHorseMat : MonoBehaviour
  5. {
  6. public List<Material> allMats;
  7. // Start is called before the first frame update
  8. void Start()
  9. {
  10. int randomIndex = Random.Range(0, allMats.Count - 1);
  11. Debug.Log("RandomIndex: " + randomIndex);
  12. GetComponentInChildren<Renderer>().material = allMats[randomIndex];
  13. }
  14. }