简体   繁体   English

如何在unity3D中克隆破坏的对象?

[英]How to clone destroyed objects in unity3D?

I made a wall that get destroyed when the character touches it and then he can keep walking. 我制作了一堵墙,当角色碰到它时便被摧毁,然后他可以继续行走。 I want to create the same wall after few seconds or after the character pass it , anyone knows how do it ? 我想在几秒钟后或在角色通过后创建同一堵墙,有人知道怎么做吗? ( I already tried it with a timer and OnCollisionExit but it didn't seem to work) (我已经用计时器和OnCollisionExit尝试过,但是似乎没有用)

  1. store a reference to your object (probably in your player script) 存储对对象的引用(可能在播放器脚本中)
  2. Set it to inactive with GameObject.SetActive(false) when you're 当您使用GameObject.SetActive(false)将其设置为非活动状态
  3. ready (your OnCollisionExit or timer function), set it to active. 准备好(您的OnCollisionExit或计时器功能),将其设置为活动状态。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM