using System.Collections; using System.Collections.Generic; using SO; using SO.Channels; using UnityEngine; using UnityEngine.UIElements; public class DocumentUpdater : MonoBehaviour { [SerializeField] private StepChangeChannelSO stepChangeChannel; [SerializeField] private SimpleChannelSO documentLoadedChannel; [SerializeField] private UnityEngine.UI.Image currentImage; private void OnEnable() { stepChangeChannel.OnStepChanged += OnStepChanged; } private void OnDisable() { stepChangeChannel.OnStepChanged -= OnStepChanged; } private void OnStepChanged(StepSO step) { currentImage.sprite = (Sprite.Create((Texture2D)step.Document, new Rect(0, 0, step.Document.width, step.Document.height), new Vector2(0.5f, 0.5f))); documentLoadedChannel.RaiseEvent(); } }