Open Another-Ghost opened 1 week ago
Could you please provide the code for line 14039 of the puerts_browser_js_resources.js file
Awake, Start, OnEnable methods are called in the base class xor.TsBehaviour, so stack information is needed to determine the problem
基类xor.TsBehaviour中会调用Awake丶Start丶OnEnable方法, 因此需要堆栈信息来确定问题
Does it work well in UnityEditor mode
And Yes, it works in Editor.
It looks like the error occurs here, but I'm not sure how it appears at the moment (the error only occurs on the WebGL platform). Could you provide a minimal reproducible demo or the WebGL build
The WebGL build uses IL2CPP, and it is possible that the code has stripped the GameObject.GetComponents method.
Please try disabling stripping or set the stripping level to 'Low' and then rebuild.
Please try disabling stripping or set the stripping level to 'Low' and then rebuild.
At the same time, you might need to use link.xml.
请问我该怎么发给你,我把 stripping level 降到最低了还是不行 又有新的错误,感觉即使用 link.xml 也得添加很多
webgl平台强制IL2CPP打包, 一般有两种常见配置来防止代码裁剪:
建议将裁剪等级设置为Low
是因为IL2CPP的高级别裁剪是按照Type.Member引用处理的(这个属性/方法你没有用到, 那么就会被裁剪). 或者在link.xml配置中插入标签preserve="all"
来保留所有类型或所有成员
谢谢,我之后试一下
BuildTestWebGL.framework.js.gz:10 Exception: TypeError: Cannot read properties of undefined (reading 'apply') at NativeObject.GetComponents (http://localhost:62260/puerts_browser_js_resources.js:14039:23) at new TsBehaviourConstructor (http://localhost:62260/puerts_browser_js_resources.js:13332:39) at new showCard (http://localhost:62260/puerts_browser_js_resources.js:12889:5) at JSFunction.init [as _func] (http://localhost:62260/puerts_browser_js_resources.js:12948:10) at JSFunction.invoke (http://localhost:62260/puerts-runtime.js:205:27) at InvokeJSFunction (http://localhost:62260/puerts-runtime.js:1390:58) at _InvokeJSFunction (http://localhost:62260/Build/BuildTestWebGL.framework.js.gz:10:35860) at http://localhost:62260/Build/BuildTestWebGL.wasm.gz:wasm-function[60840]:0x10141da at http://localhost:62260/Build/BuildTestWebGL.wasm.gz:wasm-function[22166]:0x6e8ec9 at http://localhost:62260/Build/BuildTestWebGL.wasm.gz:wasm-function[77183]:0x13ba890 at http://localhost:62260/Build/BuildTestWebGL.wasm.gz:wasm-function[83219]:0x147ffd5 at http://localhost:62260/Build/BuildTestWebGL.wasm.gz:wasm-function[87038]:0x14dfad7 at http://localhost:62260/Build/BuildTestWebGL.wasm.gz:wasm-function[106260]:0x1ddf81b at invoke_iiii (http://localhost:62260/Build/BuildTestWebGL.framework.js.gz:10:438468) at http://localhost:62260/Build/BuildTestWebGL.wasm.gz:wasm-function[87022]:0x14deb71 at http://localhost:62260/Build/BuildTestWebGL.wasm.gz:wasm-function[1072]:0xe5f96 at http://localhost:62260/Build/BuildTestWebGL.wasm.gz:wasm-function[105490]:0x1d9414e at http://localhost:62260/Build/BuildTestWebGL.wasm.gz:wasm-function[102438]:0x1d18b44 at http://localhost:62260/Build/BuildTestWebGL.wasm.gz:wasm-function[88229]:0x1568c2b at http://localhost:62260/Build/BuildTestWebGL.wasm.gz:wasm-function[88243]:0x156a272 at http://localhost:62260/Build/BuildTestWebGL.wasm.gz:wasm-function[101975]:0x1cf3376 at http://localhost:62260/Build/BuildTestWebGL.wasm.gz:wasm-function[100846]:0x1c6c83b at http://localhost:62260/Build/BuildTestWebGL.wasm.gz:wasm-function[100785]:0x1c631d0 at http://localhost:62260/Build/BuildTestWebGL.wasm.gz:wasm-function[100785]:0x1c63243 at http://localhost:62260/Build/BuildTestWebGL.wasm.gz:wasm-function[106235]:0x1dc5caa at http://localhost:62260/Build/BuildTestWebGL.wasm.gz:wasm-function[106265]:0x1ddf857 at browserIterationFunc (http://localhost:62260/Build/BuildTestWebGL.framework.js.gz:10:248128) at callUserCallback (http://localhost:62260/Build/BuildTestWebGL.framework.js.gz:10:201750) at Object.runIter (http://localhost:62260/Build/BuildTestWebGL.framework.js.gz:10:202990) at Browser_mainLoop_runner (http://localhost:62260/Build/BuildTestWebGL.framework.js.gz:10:201286) at Puerts.GenericDelegate.Action[T1] (T1 p1) [0x00000] in <00000000000000000000000000000000>:0
I built this by following the https://github.com/zombieyang/puerts_unity_webgl_demo 's instruction and click Publish-WebGL too.