Hello!
I am on the Number Wizard UI course section #42 “Using ToString()”
I have done something that I cannot figure out. My [SerializeField] TextMeshProUGUI guessText; values within Unity show MAX 1000 and MIN 1. When I went over Rick’s code everything is identical. I push play and the value displayed in my Guess Text field is showing 00. If I changed the value for MAX to 2000 it then will display 1000 on play.
What the hell am I missing lol. This will be simple I am sure. Are we permitted to paste our code here?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
public class NumberWizard : MonoBehaviour
{
[SerializeField] int max;
[SerializeField] int min;
[SerializeField] TextMeshProUGUI guessText;
int guess;
// Start is called before the first frame update
void Start()
{
StartGame();
}
void StartGame()
{
guess = (max + min) / 2;
guessText.text = guess.ToString();
max = max + 1;
}
public void OnPressHigher()
{
min = guess;
NextGuess();
}
public void OnPressLower()
{
max = guess;
NextGuess();
}
void NextGuess()
{
guess = (max + min) / 2;
}
}