动态加载resources下美术资源,报错:tex.once is not a function

  • Creator 版本:2.0.x

  • 目标平台: web

  • 详细报错信息,包含调用堆栈:Uncaught TypeError: tex.once is not a function
    at Object.loadImage (texture-util.js:46)
    at cc_SpriteFrame._loadTexture (CCSpriteFrame.js:455)
    at cc_SpriteFrame.setTexture (CCSpriteFrame.js:444)
    at cc_SpriteFrame.ctor (CCSpriteFrame.js:225)
    at new cc_SpriteFrame (eval at _createCtor (CCClass.js:609), : 10:7)
    at Object.getSpriteFrame (gameManager.js:471)

  • 重现方式:resources下美术资源在场景中有引用,并且使用 new cc.SpriteFrame(url)动态加载该资源

  • 之前哪个版本是正常的 :1.9.3

  • 编辑器操作系统 :macOS High Sierra

  • 编辑器之前是否有其它报错 :无

  • 出现概率:必现

高版本确认不再支持传入纹理路径了,需要改用loadres去实现,API文档后续将完善~

高版本后面要如何实时加载纹理?