Unity编辑脚本过程中出现0246报错

Unity2D创建角色移动脚本中,脚本报错:Assets\script\player.cs(21,36): error CS0246: The type or namespace name 'rigidbody2D' could not be found (are you missing a using directive or an assembly reference?)

用的是Unity 2022.1.4f1c1

2D的刚体类型是Rigidbody2D,你报错显示找不到类型或命名空间

你把你的player脚本粘贴出来,标明报错的哪一行位置,大概率是你大小写搞错了