当前位置:网站首页>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。
边栏推荐
- Windbg调试工具介绍
- June training (day 29) - divide and rule
- Cloud native (31) | kubernetes chapter kubernetes platform basic pre installed resources
- Gee - American landfire fire fire data set
- Write it down once Net analysis of a property management background service stuck
- CVPR上百人中招新冠,emoji成“呈堂证供”,M2 MBP被曝硬盘降速,今日更多大新闻在此...
- STM32 watchdog study
- 揭秘百度智能测试在测试自动执行领域实践
- Win32 Tetris (essential for learning MFC)
- 请问老师炒期货怎么设定安全线和安全边际?
猜你喜欢

深度学习的坎坷六十年

丢弃 Tkinter!简单配置快速生成超酷炫 GUI!

Xiaobai learns MySQL - incremental statistical SQL requirements - windowing function scheme

Uncover the secret! Pay attention to those machines under the membership system!

高校女生穿旗袍答辩!网友:导师说论文要是和旗袍一样漂亮就好了

Yyds dry inventory solution sword finger offer: find the nearest common ancestor of two nodes in the binary tree

Learn from the official motor and BLDC control strategies, and make money as soon as you learn

Introduction to reverse commissioning -pe file section table and block 03/07

Summary of binary tree exercises

LeCun用62页论文公布未来十年研究计划:AI自主智能
随机推荐
想做个答题类的微信小游戏?读这篇文章就够了
Intuition and Implementation: batch normalization
Valueerror: only TF native optimizers are supported in Eagle mode
What is the reason why the gbase8s database encountered a 951 error?
weserver发布地图服务
MySQL 1146 error [easy to understand]
成功解决NotImplementedError: numpy() is only available when eager execution is enabled.
[graduation season] it's worth it all the way over the past four years -- advice from the senior students
极光 · 哈夫曼树の生成(线段树结构 非指针)(仿邻接表)
Aurora · Huffman tree generation (segment tree structure non pointer) (imitating adjacency table)
3个最佳实践助力企业改善供应链安全
超 Nice 的表格响应式布局小技巧
测试用例设计方法之等价类划分方法
丢弃 Tkinter!简单配置快速生成超酷炫 GUI!
LeCun用62页论文公布未来十年研究计划:AI自主智能
Proteus simulation of buck switching power supply based on 51 single chip microcomputer
揭秘!付费会员制下的那些小心机!
php-fpm 启动参数及重要配置详解
Uncover the practice of Baidu intelligent test in the field of automatic test execution
Seekg() [easy to understand]