cocos 所有文件路径 的斜杠 必须 用 / 而不可以用 \
不然编译到安卓各种坑
相对路径 第一个字符不可 带 /
/*例如 res/test.png 这种应该是标准的 /res/test.png 这种在pc上可以工作 到安卓上不工作 */ //pc一切正常,android上回调函数都不带执行的 Director::getInstance()->getTextureCache()->addImageAsync("/res/test.png",[&](Texture2D* texture){ }); //正确写法 Director::getInstance()->getTextureCache()->addImageAsync("res/test.png",[&](Texture2D* texture){ }); auto animation = Animation::create(); //这种pc正常,android上直接闪退 animation->addSpriteFrameWithFile("res\\test.png"); //正确写法 animation->addSpriteFrameWithFile("res/test.png");
希望对刚接触cocos的同学有用
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。