Font build error with Cocos Creator 2.0 and cocos creator to lua/cpp

Hi I am using the cocos creator to lua/cpp support with Cocos Creator 2.0. Right now I am having an issue that when I add! a custom ttf font I receive build errors when trying to build for lua/cpp. The error says : “Uncaught TypeError: cannot read property ‘0’ of undefined at Object.get_font_path_by_uuid.” I am dragging the font to the resources folder and from there dragging it to the font item in a button label, and it is displaying perfectly in the simulator; but, whenever I try building it for lua/cpp I am getting this error and I don’t know what to do. Any help or suggestions would be greatly appreciated.

contents:
{
type”: “cc.TTFFont”,
“_name”: “Bubblegum”,
“_objFlags”: 0,
“_native”: “Bubblegum.ttf”
}

So you should change from:
state._uuid[uuid] = {
fullpath: path.join(res_dir, contents_json._rawfiles[0]),
relative_path: current_dir + ‘/’ + contents_json._rawfiles[0]
}
to
state._uuid[uuid] = {
fullpath: path.join(res_dir, contents_json._native),
relative_path: current_dir + ‘/’ + contents_json._native
}

1 Like