using System.Collections; using System.Collections.Generic; using Unity.VisualScripting; using UnityEngine; public class Colours : MonoBehaviour { public bool done = false; // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { } private void OnTriggerEnter(Collider other) { if(other.gameObject.GetComponent().material.name == gameObject.GetComponentInParent().material.name && !done) { Debug.Log("YUM! Red is my favourite colour!"); done = true; } } }