Question by
jacksond02 · Oct 22, 2021 at 11:04 AM ·
c#3d text
How to I make it when I reach 100 it goes back down to zero by 1
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class ExerciseClass : MonoBehaviour { public TextMesh refNumText; int mainNumber = 0; bool countDownCtrl = true;
void Start()
{
}
void Update()
{
refNumText.text = "" + mainNumber;
if (Input.GetKeyDown(KeyCode.UpArrow))
{
mainNumber += 2;
mainNumber += 2;
mainNumber += 2;
mainNumber += 2;
mainNumber += 2;
}
if (countDownCtrl == true)
{
if (mainNumber == 100)
{
mainNumber = 0;
mainNumber -= 1;
}
}
}
}
Comment
Your answer
Follow this Question
Related Questions
How to display elements of an array, using a 3D text Box? 1 Answer
3d Text update. How its work? 1 Answer
trying to change the color of string when i press an if statement 0 Answers
add 3d text through script on a object 1 Answer
Can someone please help me find out what wrong with my code. 0 Answers