I needed to replace the images on seven sprites at runtime, but Cocos Creator reported that the image could not be found:
The apparent image path looked correct:
The failing version included the source filename extension:
1 | for (let i = 0; i < 7; i++) { |
To load the imported SpriteFrame sub-asset, omit .png and append /spriteFrame:
1 | for (let i = 0; i < 7; i++) { |
The resource path refers to the imported asset inside a resources directory, not necessarily the original file path shown by the operating system.