I’m trying to make text that says “robbing…” reappear and disappear when showRobText
is false
. The text is simply an empty gameObject
with a text component on it.
This code doesn’t seem to be working though.
What did I do wrong?
public Text ValueText;
public Text robText;
public robManage script;
private bool showRobText = false;
public Text robbingLabel;
void Update()
{
ValueText.text = script.playerMoney.ToString();
if (script.isRobbing == true)
{
showRobText = true;
}
if (showRobText == true)
{
robText.text = "Robbing...";
Invoke("disableRobText", 3);
}
}
private void disableRobText()
{
showRobText = false;
if (showRobText == false)
{
robbingLabel = GetComponent<Text>();
robbingLabel.enabled = false;
}
}
}