引擎版本号:2.0.6
建立空项目
一个脚本hello.ts挂场景上
const {ccclass, property} = cc._decorator;
@ccclass
export default class NewClass extends cc.Component {
@property(cc.Label)
label: cc.Label = null;
@property
text: string = 'hello';
// LIFE-CYCLE CALLBACKS:
// onLoad () {}
start () {
// let a = await this.addNumber();
// (async () => {
// await this.addNumber()
// })()
console.log("hello!")
setTimeout(async () => {
await this.addNumber()
}, 1)
}
async addNumber()
{
return new Promise((resolve)=>{
console.log("hello! hello! hello!")
resolve(1+1)
})
}
// update (dt) {}
}
后面的hello! hello! hello!没有被打印。
异常信息如下图:
brick_log.info2:TypeError:null is not a constructor…
本人第一次使用creator发布轻游戏,请问大家有遇到过这个问题吗?
顺便问问官方是不是轻游戏不支持异步async await
