Text file load/display

Hello folks! I am new to cocos and while working on a scene, I tried to have a script read a dynamic file txt that holds just version number. However, I am unable to display the numbers. Cocos makes into a json but it appears as null. Is there a different way or perhaps a correct way to be able to display this? I am using cocos creator 2.3.4

Thanks!

indent preformatted text by 4 spaces

     var url = cc.url.raw('resources/version/versionNumber');
        cc.loader.load(url, function (err, data) {
            if (err) {
               cc.log("the load version file is error!");
                return;
            }
            cc.log('version: ' , data);
        });

Hi, please refer to https://docs.cocos.com/creator/manual/en/asset-workflow/json.html

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.