将预制挂载到脚本里,放到onload里调用,是否会出现预制还没加载,代码报错的情况?
@property(cc.Prefab)
testPre : cc.Prefab = null;
onLoad () {
let item = cc.instantiate(this.testPre)
item.parent = this.node
}
因为onload是脚本最开始执行的,所以好奇,脚本中挂载的预制资源,是什么时候加载的?
会不会因为网速等问题,导致prefab没有加载然后代码中报错的情况?