- Home /
for C I want to change the Collider other for the public ?
for C I want to change the Collider other for the public ?
public class TeleportExit : MonoBehaviour {
public Transform targets;
public Transform play;
public // Colider ? name
void OnTriggerExit2D(Collider2D other) // I want to change (Collider2D name)
{
play.position = targets.position;
}
}
Comment
Best Answer
Answer by Demondarem · Mar 20, 2018 at 12:46 PM
You need to set the Collider2D other to your public GameObject
public GameObject theObject;
void OnTriggerExit2D (Collider2D other)
{
theObject = other.gameObject;
}
it is different ?
public class TeleportExit : $$anonymous$$onoBehaviour {
public Transform targets;
public Transform play;
public GameObject theObject;
// Update is called once per frame
void OnTriggerExit2D(Collider2D theObject)
{
play.position = targets.position;
}
}