1
\$\begingroup\$

For some reason there is a Invoke that is triggered when a button is clicked that causes my game to crash. Any idea how I can sort this out?

I have plenty other Invokes and none has given problems. I have the Enable Exceptions option set to None and game works fine inside Unity.

I can give more info on the error if you can point to me to what's relevant. Thanks so much!

Invoking error handler due to
Uncaught abort(145) at Error
    at jsStackTrace (ed63bf36d25f876fa57fb81632b59202.unityweb:8:22380)
    at stackTrace [Object.stackTrace] (ed63bf36d25f876fa57fb81632b59202.unityweb:8:22551)
    at Object.onAbort (https://v6p9d9t4.ssl.hwcdn.net/html/1680115/PowerTheGrid_Level3_v7.2_HTML5/Build/3998187b7e8feaa618a93b293c0e6812.js:4:11065)

EDIT: Here is the code generating the error:

    public void OnClick()
    {
        if (buyCoal.interactable == true) 
        {            
                trainObject.trainMovementStart();

                if (SceneManager.GetActiveScene().name == "Level1" || SceneManager.GetActiveScene().name == "Level2")
                    Invoke("coal_refill", 6f);

                if (SceneManager.GetActiveScene().name == "Level3")
                    Invoke("coal_refill", 12f);

                Money.UseMoney(coalcost);
                buyCoalAudio.Play();
                countdown += 1; //agora é count up
                tipCoalReady = 2;
                buyCoalButtonIndex = 0; //DISABLE COAL Buy Button
                coal_stock_countdown.text = countdown.ToString();
                coaltipCounter += 1;                    
        }
    }

    void coal_refill()
    {
        ThermoElectric.quota += 17.5m;
        Invoke("reactivateBuyCoalButton", 5f);
    }
    void reactivateBuyCoalButton()
    {
        buyCoalButtonIndex = 1;
    }
}

}

\$\endgroup\$
2
  • \$\begingroup\$ It would be easier if you were to share the piece of code that is generating the error. \$\endgroup\$ Commented Sep 30, 2019 at 15:05
  • \$\begingroup\$ What is the exact error message? \$\endgroup\$ Commented Feb 4, 2021 at 20:03

1 Answer 1

0
\$\begingroup\$

I had the same error with my unity project and it solved itself, probably because I just rebuilt it twice. I did not do anything with the code. I don't know if building the project was one of the reason why the error go away.

I'm still looking forward to better solutions.

\$\endgroup\$
1
  • \$\begingroup\$ I have found I sometimes need to reboot my machine before I can make an HTML5 Build. \$\endgroup\$ Commented Jun 4, 2021 at 20:08

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.