void InitiateTeleport(ToTeleportObject toTeleportLoc) { foreach (Collider c in colliders) { c.gameObject.transform.position = toTeleportLoc.gameObject.transform.position; } Destroy(toTeleportLoc.gameObject); Destroy(this.gameObject); }
// Update is called once per frame void Update() { ToTeleportObject to = FindObjectOfType <ToTeleportObject>(); if (to != null) { InitiateTeleport(to); } }