Question by
ethanol3310 · Sep 14, 2018 at 10:56 PM ·
transformtag
This can be perceived as a 2D script. My intention is to open a door. This can be exemplified further with the fact that I may have made a mistake in Inspector dragging.
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class PlayerKeys2 : MonoBehaviour {
public GameObject door;
public GameObject key;
// Update is called once per frame
void OnCollisionEnter2D (Collider2D col) {
if(col.gameObject.tag == "Key3")
{
Destroy(door);
Destroy(key);
}
}
}
Comment
Your answer
Follow this Question
Related Questions
transform.parent.tag not working? 1 Answer
transform.parent not working? (Unity 2d) 1 Answer
Need assistance with an primitive AI. 0 Answers
How to find nearby objects? 2 Answers