Unity3d2021版本 使用DOTween插件报错The type name ‘Rigidbody2D‘ could not be found in the namespace ‘****‘问题

问题

最近在升级项目至2021版本的过程中发现了诸多这种问题,今天就遇到这样的报错:
在这里插入图片描述

Assets\Plugins\Demigiant\DOTween\Modules\DOTweenModulePhysics2D.cs(143,18): error CS1069: The type name ‘Rigidbody2D’ could not be found in the namespace ‘UnityEngine’. This type has been forwarded to assembly ‘UnityEngine.Physics2DModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null’ Enable the built in package ‘Physics 2D’ in the Package Manager window to fix this error.

Rigidbody2D(2D钢体)找不到的报错。

总结之前的问题,很快就能发现是Rigidbody2D(2D钢体)所在的包未引入的问题。

解决办法

Window > Package Manager 打开窗口:
在这里插入图片描述

选择“Packages:Built-in”,找到”Physics 2D”包并选中它,点击右下角的“Enable”按钮:

在这里插入图片描述

等待”Physics 2D”启用完成,报错将会消失
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_33789001/article/details/127123554