«TextMeshPro Scroller» - a solution for TextMeshPro that brings automatic horizontal text scrolling.
Effortlessly add dynamic scrolling effects to your Unity projects with «TextMeshPro Scroller».
Simply attach the component and configure a few settings - it's that easy!
For the correct work, «TextMeshPro Scroller» requires:
Add the TextMeshProScroller component on GameObject with TextMeshPro component. Let’s look at the parameters of the TextMeshProScroller component:
«TextMeshPro Scroller» works by dynamically adjusting the geometry of the TextMeshPro component on your GameObject. This means it directly modifies how the text is displayed on the screen based on your chosen settings.
This approach offers several benefits:
Manages scrolling animation for TextMeshPro components.
Events:
public event Action<TextMeshProScroller> OnInitialized
- invoked when the scrolling animation is initialized. Receives the scroller instance as an argument.;
public event Action<ScrollState, ScrollState> OnScrollStateChanged
- triggered when the scrolling state changes. Takes the previous and current scroll states as arguments;
public event Action<float> OnScrollStateProgressUpdated
- fired when the progress of the scrolling animation updates. Receives the current state progress (0-1) as an argument;
Properties:
public TMP_Text TextComponent { ... }
- reference to the associated TextMeshPro component;
public TextMeshProScrollerSettingsData Settings { ... }
- holds the scrolling settings applied to this component;
public ScrollState CurrentState { ... }
- indicates the current state of the animation (e.g., Idle, MoveStart, MoveEnd);
public float Progress { ... }
- represents the current progress of the animation state (0-1, where 0 is the beginning and 1 is the end);
public bool IgnoreTimescale { ... }
- determines whether the animation is affected by the time scale (useful for pausing time-based effects like animations);
public bool Initialized { … }
- indicates if the component has been successfully initialized;
Methods:
public void Init()
- initializes the component and prepares it for scrolling;
public void Play()
- starts the scrolling animation;
public void Pause()
- pauses the ongoing scrolling animation;
public void Stop()
- stops the scrolling animation completely;
public void SetEase(Ease ease)
- sets the pre-defined easing method for the scrolling animation;
public void SetEaseFunc(Func<float, float> easeFunction)
- defines a custom function to control the animation's easing behavior;
public void SetIgnoreTimeScale(bool ignore)
- enables or disables ignoring the time scale for the animation.