【unity细节】Default constructor not found for type Player(找不到默认构造函数)-LMLPHP


👨‍💻个人主页@元宇宙-秩沅

hallo 欢迎 点赞👍 收藏⭐ 留言📝 加关注✅!

本文由 秩沅 原创

收录于专栏unity细节和bug


⭐Default constructor not found for type Player ⭐



🎶描述:Default constructor not found for type Player


【unity细节】Default constructor not found for type Player(找不到默认构造函数)-LMLPHP

【unity细节】Default constructor not found for type Player(找不到默认构造函数)-LMLPHP

  • : Default constructor not found for type Player System.RuntimeType.CreateInstanceMono (System.Boolean nonPublic, System.Boolean wrapExceptions) (at <88e4733ac7bc4ae1b496735e6b83bbd3>:0) System.RuntimeType.CreateInstanceSlow (System.Boolean publicOnly, System.Boolean wrapExceptions, System.Boolean skipCheckThis, System.Boolean fillCache) (at <88e4733ac7bc4ae1b496735e6b83bbd3>:0) System.RuntimeType.CreateInstanceDefaultCtor (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Boolean wrapExceptions, System.Threading.StackCrawlMark& stackMark) (at <88e4733ac7bc4ae1b496735e6b83bbd3>:0)

🎶原因


  • 程序中有类,未设置构造函数。原因是由于写了有参构造函数,导致默认构造函数被覆盖

🎶解决


  • 只需要把构造函数添加进去即可
    【unity细节】Default constructor not found for type Player(找不到默认构造函数)-LMLPHP

解决了点个赞,关注下吧✅


⭐相关文章⭐

【2023unity游戏制作-mango的冒险】-开始画面API制作

【unity游戏制作-mango的冒险】-场景搭建

“狂飙”游戏制作—游戏分类图鉴(网易游学)

本站最全-unity常用API大全(万字详解),不信你不收藏



你们的点赞👍 收藏⭐ 留言📝 关注✅是我持续创作,输出优质内容的最大动力!

06-07 11:32