Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unity Application.Loadlevel is not working

I'm using soomla package for in-app purchasing and I met a strange error to build my game, and it is very difficult to solve for me.

In the callback function OnMarketPurchase, I call this code.

public void OnMarketPurchase(PurchaseableVirtualItem pvi, string payload, Dictionary<string,string> extra){
   if(pvi.ItemId == "purchaseable_item_id"){
     GlobalScript.setLiteVersionFlag();
     if(GoogleADS!=null)
        GoogleADS.SendMessage("DestroyBanner");
    Application.loadLevel("GameScene1");
   }
}

In here, GoogleADS is a gameobject that is published on Start() function.

I could see the result of GlobalScript.setLiteVersionFlag() and GoogleADS.sendMessage.

But, loadlevel is not working. I don't know why this happens?

like image 352
NewBeginner Avatar asked Jul 26 '26 22:07

NewBeginner


1 Answers

You have not shared the complete code, so I can only guess -

  1. if(pvi.ItemId == "purchaseable_item_id") is not evaluating as true
  2. OnMarketPurchase is not getting called
  3. GameScene1 is named incorrectly
  4. GameScene1 has not been added to "Scenes in build"
like image 63
Patt Mehta Avatar answered Jul 29 '26 11:07

Patt Mehta