javascriptcocos2d-jscocoscreator

TypeError: Cannot read property 'load' of undefined at cc.resources


When I try to use cc.resources.load(arg1, arg2), I get this error:

Uncaught (in promise) TypeError: Cannot read property 'load' of undefined

As far as I know, it is a built-in Cocos Creator class and the documentation itself says to use it. When I try to call cc.log(cc.resources), it shows undefined in the console. A folder called "resources" exists in my project and it's not empty.


Solution

  • cc.resources isn't available in Cocos Creator 2.3.3, only 2.4.

    The solution is to use the function cc.loader.loadRes.