using UnityEngine; using UnityEngine.UI; public class Notiz : MonoBehaviour { public Button Antworteins; public Button Antwortzwei; // Richtige Antwort public Button Antwortdrei; public Color correctAnswerColor = Color.green; public Color falseAnswerColor = Color.red; void Start() { Antwortzwei.onClick.AddListener(OnAntwortzweiClicked); Antworteins.onClick.AddListener(OnAntworteinsClicked); } private void OnAntwortzweiClicked() { Debug.Log("Antwort zwei Button geklickt"); Transform frontPlateTransform = Antwortzwei.transform.Find("ButtonContent/CompressableButtonVisuals/FrontPlate"); if (frontPlateTransform != null) { Image frontPlateImage = frontPlateTransform.GetComponent<Image>(); if (frontPlateImage != null) { frontPlateImage.color = correctAnswerColor; Debug.Log("Farbe ge�ndert zu Gr�n"); } else { Debug.LogError("Image component not found on FrontPlate!"); } } else { Debug.LogError("FrontPlate not found!"); } } private void OnAntworteinsClicked() { Debug.Log("Antwort eins Button geklickt"); Transform frontPlateTransform = Antworteins.transform.Find("ButtonContent/CompressableButtonVisuals/FrontPlate"); if (frontPlateTransform != null) { Image frontPlateImage = frontPlateTransform.GetComponent<Image>(); if (frontPlateImage != null) { frontPlateImage.color = falseAnswerColor; Debug.Log("Farbe ge�ndert zu Rot"); } else { Debug.LogError("Image component not found on FrontPlate!"); } } else { Debug.LogError("FrontPlate not found!"); } } }