using Common.Events; using MessagePipe; using UnityEngine; namespace Common.Mono { public class ScreenResizeHandler : MonoBehaviour { private IPublisher _screenResizePublisher; private int _lastWidth; private int _lastHeight; private void Start() { ScreenResizeFixation(); } private void Update() { ScreenResizeFixation(); } private void ScreenResizeFixation() { if (_lastWidth != Screen.width || _lastHeight != Screen.height) { _lastHeight = Screen.height; _lastWidth = Screen.width; _screenResizePublisher.Publish(new ScreenResizeEvent() { width = _lastWidth, height = _lastHeight, }); } } } }