Text Animator for Unity
More ToolsTutorialsDiscord✨ Get Text Animator ✨
2.X 🇬🇧
2.X 🇬🇧
  • ❤️Welcome
    • Text Animator for Unity
    • Features
    • Games Showcase
    • Quick Start
  • ✨effects
    • Add effects to your texts
      • Modifiers
      • Styles
      • Databases
    • Preview and Edit effects
      • Dynamic Scaling
      • Time Scale
    • Built-in effects list
    • Create your own effects
      • Create effects in the Inspector
        • Curve Effects
        • Composite Effects
      • Writing Custom Effects (C#)
  • ✏️typewriter
    • Show and hide letters dynamically
    • Play sounds when a letter is shown
    • Trigger Events when typing
    • Wait Actions when typing
  • 🤝Integrations
    • Integrated Plugins & Dialogues Systems
      • Dialogue System for Unity
      • Yarn Spinner
      • Ink
      • Game Creator 2
      • Unity Localization Package
      • Playmaker
      • Unity Visual Scripting
      • Naninovel
    • How to manually integrate Text Animator
  • Extra Customization via C#
    • Writing Custom Typewriters (C#)
    • Writing Custom Actions (C#)
  • Other
    • Best Practices
    • Requirements & Limitations
    • Frequently Asked Questions
    • Support
    • Changelog
      • 2.X
      • Upgrading from 1.X to 2.X
      • 1.X
    • Scripting API
Powered by GitBook
On this page
  • Adding Custom Typewriters
  • Fundamental Methods
  • Optional Methods
  1. Extra Customization via C#

Writing Custom Typewriters (C#)

PreviousExtra Customization via C#NextWriting Custom Actions (C#)

Last updated 7 months ago

By using “Text Animator for Unity” you can create your own custom typewriters, setting different types of delays between letters and much more. (If you want to learn about the default typewriter instead, ).


Adding Custom Typewriters

In order to create a custom typewriter for your game, you need to to create a custom class that inherits from Febucci.UI.Core.TypewriterCore [].

Fundamental Methods

You have to override/implement the following methods:

float GetWaitAppearanceTimeOf(int charIndex)

It tells the typewriter how much time to wait for each character. This way, you can implement your own special characters that need an unique wait time and more.

You can access the character from the index by doing as follows:

char character = TextAnimator.Characters[charIndex].info.character

For example, in order to have a different wait time when typing punctuations:


[SerializeField] float normalTime = .1f;
[SerializeField] float punctuationTime = .3f;
protected override float GetWaitAppearanceTimeOf(int charIndex)
{
    char character = TextAnimator.Characters[charIndex].info.character;
    return char.IsPunctuation(character) ? punctuationTime : normalTime;
}

Optional Methods

You can also override the following methods for extra functionalities.

float GetWaitDisappearanceTimeOf(int charIndex)

Override this method in case you want different disappearance wait times/speed. Otherwise, your custom textAnimatorPlayer will use the same delays as its typewriter (GetWaitAppearanceTimeOf);


✅ That’s it! Really!

👍🏻 Don’t forget to add your typewriter component on the same gameObject that has a TextAnimator one.

Have fun implementing your own typewriters <3

read here
Scripting API