html5 abort,c# - Unity Help solving Uncaught Abort on HTML5 Build - Stack Overflow

在Unity游戏中,当点击一个按钮时,一个Invoke被触发并导致游戏崩溃。尽管其他Invoke没有问题,但这个特定的Invoke在'Level1'或'Level2'场景中调用'coal_refill'函数并在'Level3'场景中调用同一函数但延迟时间不同。错误日志显示与Invoke有关的异常。问题可能与函数调用、资源管理或场景交互有关。
摘要由CSDN通过智能技术生成

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.

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;

}

Error Log:

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)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值