Open jareguo opened 2 years ago
Like mentioned on Trello side and in the screenshot above:
Would it be possible to make functions like instantiate(prefab)
asynchronous as well? and maybe even functions like node.addNode(...)
/ node.destroy()
?
Especially instantiate() can sometimes take a a while to instantiate a bigger prefab on a weak device. I know there are workaround like adding a component on the prefab and running onLoad() or such function to see when it is ready, but it would help a lot to know when the prefab you instantiated is ready just by await instantiate(prefab)
, so clean.
It's 2022, and it's time to evaluate fully enabling Promise. From a compatibility perspective, a more general solution is to determine whether to use Promise based on the callback function passed in. Old style:
New style:
From https://forum.cocos.org/t/creator/82949 See also