[Unity] Component.CompareTag 정리
간단하게 설명하기!
game Object에 인자로 받은 tag가 tagged 되어있는지에 대한 bool값을 리턴한다!
public bool CompareTag(string tag);
Parameters
tag | 비교할 tag |
Description
해당 gameObject에 tag가 tagged되어 있으면 true, 아니면 false를 return 한다
// Immediate death trigger. // Destroys any colliders that enter the trigger, if they are tagged player. using UnityEngine; using System.Collections; public class ExampleClass : MonoBehaviour { void OnTriggerEnter(Collider other) { if (other.gameObject.CompareTag("Player")) { Destroy(other.gameObject); } } }
Unity Documentation : https://docs.unity3d.com/ScriptReference/Component.CompareTag.html
'etc > Unity' 카테고리의 다른 글
[Unity] Transform 정리 (0) | 2020.06.01 |
---|---|
[Unity] Raycasthit 정리 (0) | 2020.06.01 |
[Unity] Physics.Raycast 정리 (0) | 2020.06.01 |
[Unity] Object.Instantiate 정리 (0) | 2020.05.31 |
댓글
이 글 공유하기
다른 글
-
[Unity] Transform 정리
[Unity] Transform 정리
2020.06.01 -
[Unity] Raycasthit 정리
[Unity] Raycasthit 정리
2020.06.01 -
[Unity] Physics.Raycast 정리
[Unity] Physics.Raycast 정리
2020.06.01 -
[Unity] Object.Instantiate 정리
[Unity] Object.Instantiate 정리
2020.05.31
댓글을 사용할 수 없습니다.