当前位置:网站首页>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。
边栏推荐
- Is it safe to open an account online?
- 【毕业季】这四年一路走来都很值得——老学长の忠告
- matplotlib的imshow函数显示灰度图像要设置vmin和vmax2个参数
- WinDbg debugging tool introduction
- College girls wear cheongsam to defend! Netizen: the tutor said it would be nice if the paper were as beautiful as the cheongsam
- 【无标题】安装依赖报错:Refusing to install package with name “***“ under a package
- Proteus simulation of buck switching power supply based on 51 single chip microcomputer
- C keyboard hook
- ANSVC无功补偿装置在河北某购物广场中的应用
- 自主可控再下一城!首套国产ARTIQ架构量子计算测控系统发布
猜你喜欢

Appkey when applying for offline packaging of uniapp

sqlite3入门

深度学习的坎坷六十年

3个最佳实践助力企业改善供应链安全

揭秘百度智能测试在测试自动执行领域实践

Koa2+better-sqlite3 to add, delete, change and query

Uncover the practice of Baidu intelligent test in the field of automatic test execution

System.currentTimeMillis() 和 System.nanoTime() 哪个更快?大部分人都会答错!

Equivalence class partition method for test case design method

DeeCamp2022正式开营!李开复、张亚勤亲授大师课 | 创新事
随机推荐
C keyboard hook
Discard Tkinter! Simple configuration to quickly generate cool GUI!
Windbg调试工具介绍
Weserver publishing map service
硬件开发笔记(八): 硬件开发基本流程,制作一个USB转RS232的模块(七):创建基础DIP元器件(晶振)封装并关联原理图元器件
Openssl证书工具使用手册
matplotlib的imshow函数显示灰度图像要设置vmin和vmax2个参数
Leetcode question brushing: String 07 (repeated substring)
koa2+better-sqlite3实现增删改查
Hundreds of CVPR people were recruited as new champions. Emoji became a "court witness". M2 MBP was exposed that the hard disk speed was reduced. Today, more big news is here
思科模拟器简单校园网设计,期末作业难度
The node command in the script does not print the execution log on the console
揭秘!付费会员制下的那些小心机!
运动App如何实现端侧后台保活,让运动记录更完整?
grep 精确匹配
OpenSSL certificate tool user manual
Learn from the official motor and BLDC control strategies, and make money as soon as you learn
MySQL 1146 error [easy to understand]
Dynamic feedback load balancing strategy based on Cluster
MySQL intercepts the string to remove duplication, and MySQL intercepts the string to remove reassembly