zombieyang / puerts_unity_webgl_demo

在Unity里用Typescript写小游戏/Web游戏
BSD 3-Clause "New" or "Revised" License
186 stars 66 forks source link

[unity] TypeError: CS.Puerts.PathHelper.IsRelative is not a function #61

Closed Yiiip closed 4 months ago

Yiiip commented 4 months ago

error log | 日志或报错信息

TypeError: CS.Puerts.PathHelper.IsRelative is not a function 如图: Picture

context | 编译/运行环境

Unity WebGL PuerTS WebGL 2.0.5

在UnityEditor中正常运行,打包到WebBrowser中报了错

zombieyang commented 4 months ago

https://github.com/Tencent/puerts/blob/master/unity/Assets/core/upm/Runtime/Src/PathHelper.cs#L17 给这个函数加个[Preserve]防裁剪试试

Yiiip commented 4 months ago

https://github.com/Tencent/puerts/blob/master/unity/Assets/core/upm/Runtime/Src/PathHelper.cs#L17 给这个函数加个[Preserve]防裁剪试试

试了下有效果,除了IsRelative外,PathHelper里其他的静态函数也要加上[UnityEngine.Scripting.Preserve]