Scenario 1
let node: cc.Node = cc.instantiatet(cc.loader.getRes(""));
let xx: Xxx = node.getComponent(Xxx);
xx.setData();
Calling sequence lifecycle functions such cases classes Xxx is a public method called directly Xxx, setData ().
Scenario 2
// parentNode
let node: cc.Node = cc.instantiatet(cc.loader.getRes(""));
let xx: Xxx = node.getComponent(Xxx);
xx.setData();
parentNode.addChild(node);
This situation calling sequence function in the life cycle of the class Xxx is
to call the onLoad () ->
and public Method ->
last start ()
Reproduced in: https: //www.jianshu.com/p/9b56a17f1028