// Start is called before the first frame update void Start() { myKey = int.Parse(gameObject.name.Substring(gameObject.name.Length - 1)); audioPlayer = GameObject.FindWithTag("AudioControl").GetComponent <Audio_Controler>(); try { Main_Control_Script = GameObject.FindGameObjectWithTag("Player").GetComponent <Main_Control_Script>(); } catch { Debug.LogError("ERROR: Corner did not find Main_Control_Script!"); } myMaterial = Main_Control_Script.MaterialColors[myKey]; gameObject.GetComponent <MeshRenderer>().material = myMaterial; }
void Start() { audioPlayer = GameObject.FindGameObjectWithTag("AudioControl").GetComponent <Audio_Controler>(); Main_Control_Script = gameObject.GetComponent <Main_Control_Script>(); }