Unity 升级引擎版本后构建报错:script class layout is incompatible between the editor and the player

Unity升级引擎版本后,项目报错:script class layout is incompatible between the editor and the player

问题如何出现

报错信息在标题已经贴出来了,这里讲下我突然遇到这个问题的原因。
之前使用的是Unity2022的一个老版本,为了使用Unity最新的一些特性支持,我升级到Unity2022.3.61f1c1的新版本。紧接着在其他都没有更改的情况下,我这个项目的自动化构建就失败了,构建日志报错就是:script class layout is incompatible between the editor and the player。


问题如何解决

首先还是搜索网上资料吧,但其实没有什么有用的信息。比如有的人说过几天自动好了,有的人说重装Unity的,反正看着就有点懵,感觉不是解决的路子。比如下面这些相关资料:
https://discussions.unity.com/t/script-class-layout-is-incompatible-between-the-editor-and-the-player/493612/9
https://github.com/SaladLab/Unity3D.IncrementalCompiler/issues/21
https://issuetracker.unity3d.com/issues/error-building-player-because-script-class-layout-is-incompatible-between-the-editor-and-the-player-dot-error-when-trying-to-build-on-webgl

没有什么太多信息的时候,肯定要亲手打开Unity项目看一看吧。奇妙的就是,打开之后,没有任何报错。我在引擎中手动去构建APK,也没有遇到问题。

最后还是回到这个报错的信息上,提示的是C#脚本在 editor and player 上的差异

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值