当前位置:网站首页>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。
边栏推荐
- Getting started with SQLite3
- 成功解决ValueError: Only TF native optimizers are supported in Eager mode
- Online text filter less than specified length tool
- Intuition and Implementation: batch normalization
- 脚本中的node命令不在控制台打印执行日志
- 揭秘百度智能测试在测试自动执行领域实践
- Introduction to esp8266: three programming methods "suggestions collection"
- Teach you how to install the latest version of mysql8.0 database on windows, nanny level teaching
- 记一次 .NET 某物管后台服务 卡死分析
- 硬件开发笔记(八): 硬件开发基本流程,制作一个USB转RS232的模块(七):创建基础DIP元器件(晶振)封装并关联原理图元器件
猜你喜欢

【系统设计】邻近服务

Summary of binary tree exercises

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

如何优雅的写 Controller 层代码?

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

Windbg调试工具介绍

Windbg常用命令详解

weserver發布地圖服務

云原生(三十一) | Kubernetes篇之Kubernetes平台基本预装资源

Detailed explanation of PDB symbol library files
随机推荐
##Mondo Rescue制作镜像文件(有利于镜像损坏恢复)
Huawei machine learning service speech recognition function enables applications to paint "sound" and color
存算一体为何是造芯新方向?|对撞派 x 知存科技
超 Nice 的表格响应式布局小技巧
Weserver Publishing Map Service
iMile 利用 Zadig 多云环境周部署千次,跨云跨地域持续交付全球业务
Solution to inconsistency between RTC time and world time on the server
嵌入式开发:硬件在环测试
脚本中的node命令不在控制台打印执行日志
Exploring the way of automated testing - Preparation
如何优雅的写 Controller 层代码?
Lecun published a research plan for the next decade: AI autonomous intelligence with a 62 page paper
Cicd introduction [easy to understand]
成功解决ValueError: Only TF native optimizers are supported in Eager mode
GBase8s数据库遇到951错误是什么原因?
STM32 watchdog study
How to install MySQL 8.0 on rocky Linux and almalinux
Introduction to esp8266: three programming methods "suggestions collection"
Detailed explanation of C language pointer
Cloud native (31) | kubernetes chapter kubernetes platform basic pre installed resources