admin管理员组文章数量:1565797
unity3d销毁游戏对象
As important instantiating and modifying gameObjects is in a game, it's equally important to destroy them when they are not required.
由于在游戏中实例化和修改gameObjects很重要,因此在不需要它们时销毁它们同样重要。
Main reasons for destroying gameObjects include managing memory, getting rid of not-needed gameObjects (Like those that go beyond the camera and don't return), or even game-related events (Getting hit by a bullet).
销毁游戏对象的主要原因包括管理内存 , 清除不需要的游戏对象 (就像那些超出摄像头且不会返回的对象),甚至是与游戏相关的事件(被子弹击中)。
Destroy(gameObject):
That's the code which is used to destroy a gameObject. Fairly simple, isn't it? Let's rewind and have a slightly more deeper look at what's going on. If you try to explore the Destroy
method in your IDE, you will see that the Destroy method has 2 variants(overloaded forms).
Destroy(gameObject):
这是用于销毁游戏对象的代码。 很简单,不是吗? 让我们倒带,对发生的事情有更深入的了解。 如果您尝试在IDE中探索Destroy
方法,则会看到Destroy方法具有2个变体(重载表格)。
The first overload form simply Destroys the gameObject that's input as a parameter, and nothing else.
第一个重载形式只是销毁作为参数输入的gameObject,而没有其他任何事情。
While, the second overload form, involves another parameter time, t
as a float
variable. This will wait for the time specified in seconds
版权声明:本文标题:unity3d销毁游戏对象_如何在Unity 3D中销毁游戏对象 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/dongtai/1725430433a1022852.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论