当前位置:网站首页>Unity 关于Destroy 和 OnDestroy失效(延迟)的问题
Unity 关于Destroy 和 OnDestroy失效(延迟)的问题
2022-06-29 12:48:00 【迷lù】
场景:在做一个回合制小游戏时,我方角色开火后,需要等待子弹全部消失(Destroy),敌方才会开始操作,如何判断子弹全部消失,就是通过它们的父级如何transform.childCount==0; 但是出现了bug
原因: Destroy后,对象并没有马上消失,而是等下一帧,所以transform.childCount !=0。
解决办法:先bullet.transform.setParent(null);再 Destroy。
边栏推荐
- 直觉与实现:Batch Normalization
- 灵感收集·创意写作软件评测:Flomo、Obsidian Memo、Napkin、FlowUs
- Mondo rescue creates an image file (which is conducive to image damage recovery)
- Matlab fmincon precision, fmincon and quadprog error
- Appkey when applying for offline packaging of uniapp
- grep 精确匹配
- How to set the safety line and safety margin for futures trading?
- 成功解决ValueError: Only TF native optimizers are supported in Eager mode
- pdb符号库文件详解
- MySQL 1146 error [easy to understand]
猜你喜欢

DeeCamp2022正式开营!李开复、张亚勤亲授大师课 | 创新事

手把手教你在windows上安装mysql8.0最新版本数据库,保姆级教学

华为机器学习服务语音识别功能,让应用绘“声”绘色

Application of ansvc reactive power compensation device in a shopping mall in Hebei

二叉树习题总结

Leetcode question brushing: String 07 (repeated substring)

Teach you how to install the latest version of mysql8.0 database on windows, nanny level teaching

win32版俄罗斯方块(学习MFC必不可少)

Qitai observation: professional elites must step on the huge pit of entrepreneurship - learning effect pit

#yyds干货盘点# 解决剑指offer:在二叉树中找到两个节点的最近公共祖先
随机推荐
Hash hash game system development explanation technology -- hash game system development solution analysis
自主可控再下一城!首套国产ARTIQ架构量子计算测控系统发布
【毕业季】这四年一路走来都很值得——老学长の忠告
Exploring the way of automated testing - Preparation
Introduction to esp8266: three programming methods "suggestions collection"
Koa2+better-sqlite3 to add, delete, change and query
Summary of common MySQL statements and commands
GBase8s数据库遇到951错误是什么原因?
打造一个 API 快速开发平台,牛逼!
机器学习 Out-of-Fold 折外预测详解 | 使用折外预测 OOF 评估模型的泛化性能和构建集成模型
Open source machine learning platform
Leetcode question brushing: String 07 (repeated substring)
MySQL 1146 error [easy to understand]
DeeCamp2022正式开营!李开复、张亚勤亲授大师课 | 创新事
win32版俄罗斯方块(学习MFC必不可少)
Want to make a wechat game for answering questions? Reading this article is enough
技术分享| 融合调度中的广播功能设计
Technology sharing | broadcast function design in integrated dispatching
Aurora · Huffman tree generation (segment tree structure non pointer) (imitating adjacency table)
Xiaobai learns MySQL - incremental statistical SQL requirements - windowing function scheme