2018年8月1日
removeChild与destroy区别
在A场景,我通过cc.instantiate预制了一个动画放到了舞台上,随后我游戏部分逻辑执行完,
通过removeChild移除了这个预制,并跳转场景B,
到B场景,执行游戏逻辑,最后会有一个cc.director.loadScene从新返回到场景A。
但是当我返回时候,发现我的cc.instantiate节点的东西都没了,
理论上来说我通过cc.director.loadScene初始化了游戏场景,重新开始,这个东西都是存在的
我带着疑惑尝试将removeChild,改成了destroy,返回cc.director.loadScene场景A时候,这个instantiate还是存在,到这里能看到比较明显的对比效果,
随后我查看文档,
removeChild
destroy
removeChild虽然销毁了节点中的逻辑,但是他并没有把逻辑彻底从内存中清理掉,仅仅是“移除”
这也是为啥后面我调用cc.director.loadScene返回A场景时候 他是黑屏状态。
而destroy彻底销毁并且从内存清理,使得我调用cc.director.loadScene返回A场景时候,他还是存在的。


References:
Tuscany suites and casino hamzahwito826748.blogsvila.com
whoah thijs bloig iss xcellent i lioe readimg
ykur articles. Staay upp the great work!
Yoou know, many people are lookijng rlund foor thiss information, yyou cann aidd tjem greatly.
Look at my wbsite redwap.pro
Today, whiile I wwas aat work, mmy siseter stolle my iphone andd
tesed tto ssee if itt can survife a tnirty fopt drop, just sso shee
caan bbe a youtube sensation. My apploe ipad is noww
destrroyed aand sshe haas 83 views. I know thijs iss toptally offf
topic bbut I haad tto share it with someone! xnxx