Im really stuck here and struggling to figure out what the hell is going on.
I have this script attached to a gameobject. It points to various TextMeshPro UI elements and in theory (I have done this before with standard text and it worked fine) it should work, but when I hit play, the inspector gets rid of the things I have set. I have included screenshots as I dont know how to word this properly. Thank you.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
public class Questions : MonoBehaviour
{
public TextMeshProUGUI question;
public TextMeshProUGUI answera;
public TextMeshProUGUI answerb;
public TextMeshProUGUI answerc;
public string questiontext;
private string answeratext;
private string answerbtext;
private string answerctext;
void Start()
{
question = GetComponent<TextMeshProUGUI>();
answera = GetComponent<TextMeshProUGUI>();
answerb = GetComponent<TextMeshProUGUI>();
answerc = GetComponent<TextMeshProUGUI>();
questiontext = "When asked to dice an onion, or similar ingredient. What shape do you expect to find the final product?";
answeratext = "cubes";
answerbtext = "strips";
answerctext = "rounds";
}
void Update()
{
question.text = questiontext.ToString();
answera.text = answeratext.ToString();
answerb.text = answerbtext.ToString();
answerc.text = answerctext.ToString();
}
}