Hi everyone. Very simply put, I have a button which ends the player’s turn and ages the character. I want the textbox to print of the player’s age at the end of each turn using the following code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;
public class Eventmanager : MonoBehaviour
{
TextMeshProUGUI count;
// Start is called before the first frame update
void Start()
{
count = GetComponent<TextMeshProUGUI>();
}
// Update is called once per frame
void Update()
{
count.text = "Age: " + Character.Age + "
";
}
}
Obviously, the above code just creates an area called “Age:” and updates the character’s age on update. I want the script to create a new line and show the new age every time the age button is clicked. I’m assuming I will have to create a list that stores all previous ages however I’m yet to understand how I can do that. I have experimented with using a list but I keep getting “cannot implicitly convert” errors and several other problems.
TIA