Introduction

 «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!

Requirements

 For the correct work, «TextMeshPro Scroller» requires:

  • Unity 2020.3 or newer: This ensures compatibility with the features used by «TextMeshPro Scroller»;
  • TextMeshPro package installed: This is the core library that TextMesh Pro Scroller interacts with.
  • Quick Start

     Add the TextMeshProScroller component on GameObject with TextMeshPro component. Let’s look at the parameters of the TextMeshProScroller component:

    TextMeshProScroller Component
    • Text Component - this field should automatically reference the attached TextMeshPro component. However, you can verify and change it if needed;
    • Use Global Settings - in case of checked: use the global settings defined in the Assets/TextMeshProScroller/Resources/TextMeshProScrollerSettings.asset file for all parameters like Scroll Method, Ease, Scroll Speed, and delays. In case of unchecked: Configure these parameters directly within the component's inspector for this specific instance;
    • Scroll Method - text scrolling method. Supported methods:
      • Ping Pong - text scrolls back and forth, revealing sections on either side;
      • Full Scroll - text scrolls until it disappears completely and then resumes scrolling from the opposite side.
    • Ease - the animation curve to define how the scrolling speed varies over time. Numerous ease options are available;
    • Scroll Speed - the speed of the scrolling animation;
    • Start Delay - delay in seconds on start scrolling;
    • End Delay - delay in seconds on end scrolling;
    • Scroll Width Delta - adjust this value (in TMP vertices local space) to refine the scrolling if the text bounds are slightly larger than the RectTransform size, potentially preventing unnecessary scrolling when the text fits fully.
     After setting the component, user can enter play mode to preview the scrolling animation.
    Note: if the text width is less than or equal to the RectTransform width, the text won't scroll as it already fits within the designated space.
     A few examples of different scroll methods and ease:
    Ping Pong, Linear Ease:
    Ping Pong, Linear Ease example
    Ping Pong, InOutCubic Ease:
    Ping Pong, InOutCubic Ease
    Full Scroll, Linear Ease:
    Full Scroll, Linear Ease
    Full Scroll, InOutBack Ease:
    Full Scroll, InOutBack Ease

    How it works

     «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:

    • Efficient Performance: Modifying text geometry is a relatively inexpensive operation, even on lower-end devices. This translates to smooth scrolling performance without impacting your game's overall performance;
    • Customization: By directly manipulating the text geometry, TextMesh Pro Scroller allows for precise control over the scrolling behavior, enabling you to achieve the desired visual effects.

    API Help

    TextMeshProScroller

     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.

    Contacts

    Please let me know if you have any questions, ideas, or suggestions.
    If you require support, please provide your invoice number. The more information you provide, the more effectively I can assist you.
    E-mail: unitymedved@gmail.com