- Home /
Question by
Ace_Dares13 · Jan 09, 2021 at 02:56 AM ·
sceneinvoke
Invoke doesnt work after loading scene
Hey so I have a problem with my invoke function What happens is that in the main menu scene where the invoke plays it works perfectly but when i switch to another scene and back, then the game acts like the invoke doesn't even exist.
public void Buy()
{
//In case needed, otherwise irrelevant
if(i == 0)
{
Debug.Log("Select a powerup");
}
if(i == 1)
{
if (money >= extrajumpprice)
{
Debug.Log("You Bought ExtraJump");
money -= extrajumpprice;
SaveMoney2();
buyinginfo.SetActive(true);
buyinfo = GameObject.Find("BuyingInfoText").GetComponent<TMPro.TextMeshProUGUI>();
buyinfo.text = "You Bought an ExtraJump";
i = 0;
}
else { Debug.Log("You don't have enough money"); }
}
if (i == 2)
{
if (money >= firerateprice)
{
Debug.Log("You Bought FireRate");
money -= firerateprice;
buyinginfo.SetActive(true);
buyinfo = GameObject.Find("BuyingInfoText").GetComponent<TMPro.TextMeshProUGUI>();
buyinfo.text = "You Bought 'FireRate' ";
i = 0;
}
else { Debug.Log("You don't have enough money"); }
}
if (i == 3)
{
if (money >= speedprice)
{
Debug.Log("You Bought Speed");
money -= speedprice;
buyinginfo.SetActive(true);
buyinfo = GameObject.Find("BuyingInfoText").GetComponent<TMPro.TextMeshProUGUI>();
buyinfo.text = "You Bought More Speed ";
i = 0;
}
else { Debug.Log("You don't have enough money"); }
}
//In case needed, otherwise irrelevant
Invoke("BuyingDelay", 1.4f);
}
Comment
Your answer
Follow this Question
Related Questions
Editor hook for opening / closing a scene 0 Answers
Click handling at world scene level 1 Answer
Destroy All Objects In The Scene??? 1 Answer
Change scenes from area? 1 Answer
Multiple world spaces? 0 Answers