I’ve been over this a million times and can’t figure out why it’s returning null…
function OnTriggerEnter (other : Collider) {
var player = GameObject.Find("Player");
var test = player.GetComponent(tag);
Debug.Log (test);
}
I’ve been over this a million times and can’t figure out why it’s returning null…
function OnTriggerEnter (other : Collider) {
var player = GameObject.Find("Player");
var test = player.GetComponent(tag);
Debug.Log (test);
}
As WillTATL said in the comments, the code you’re looking for is:
var test = player.tag;
Tags are members of the gameObject they belong to, rather than a distinct component.