차이
문서의 선택한 두 판 사이의 차이를 보여줍니다.
| 양쪽 이전 판이전 판다음 판 | 이전 판 | ||
| unity:타이머로_프리팹_제거하기 [2016/06/22 06:53] – 115.93.88.196 | unity:타이머로_프리팹_제거하기 [2018/02/22 03:04] (현재) – 바깥 편집 127.0.0.1 | ||
|---|---|---|---|
| 줄 1: | 줄 1: | ||
| + | {{tag> | ||
| ====== 타이머로 프리팹 제거하기 ====== | ====== 타이머로 프리팹 제거하기 ====== | ||
| 총알등의 [[unity: | 총알등의 [[unity: | ||
| + | ([[http:// | ||
| + | |||
| 프리팹 만드는 법은 [[unity: | 프리팹 만드는 법은 [[unity: | ||
| <file csharp> | <file csharp> | ||
| 줄 12: | 줄 15: | ||
| } | } | ||
| </ | </ | ||
| + | |||
| + | [[prefab]]에 스크립트를 넣으면 된다. | ||
| - | 출처: [[http:// | ||
| - | 위의 방법으로 하면 본체가 제거된다. 클론을 제거하려면 아래와 같이 한다 ([[http:// | ||
| - | < | + | 클론을 제거하려면 아래와 같이 한다 ([[http:// |
| + | |||
| + | < | ||
| public class bolt_move : MonoBehaviour { | public class bolt_move : MonoBehaviour { | ||
| GameObject item; | GameObject item; | ||
| - | public float speed; | + | |
| public float lifeTime = 1.0f; // | public float lifeTime = 1.0f; // | ||
| - | // Use this for initialization | + | |
| - | void Start () { | + | void Start () { |
| Destroy(GameObject.Find(item.name + " | Destroy(GameObject.Find(item.name + " | ||
| //prefab timed removal | //prefab timed removal | ||
| - | // | + | // http:// |
| + | | ||
| } | } | ||
| 줄 38: | 줄 44: | ||
| - | {{tag> | + | |