// For the OnTriggerStay2D event to be fired while the object is in contact, the Rigid2D body Sleep Mode // has to be on "Never Sleep", otherwise this is only triggered once void OnTriggerEnter2D(Collider2D other) { if (!IsPortal(other) || IsTeleporting() || IsPaused()) { return; } var calculatedPortal = CalculatePortal(GetPortal(other)); _pendingTeleport = calculatedPortal; if (_pendingTeleport.soundEffect) { GameManager.Audio.PlaySfx(_pendingTeleport.soundEffect); } if (!(transitionController is null)) { transitionController.TransitionOutIn(); }