Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

7 Commits

Repository files navigation

StringWriter – Typewriter Text Utility for Unity

StringWriter is a small and efficient C# helper class for Unity that creates a typewriter-style text effect using TextMeshProUGUI.
It gradually displays text character by character, making it ideal for dialogue systems, storytelling UI, loading hints, or any other animated text display.


➡️ Features

  • Simple setup with just a few lines of code
  • Adjustable writing speed
  • Optimized with StringBuilder for better performance
  • Fully compatible with Unity Coroutines
  • Open source under the MIT License

🧾 How It Works

When you create a StringWriter instance, you provide:

  1. A TextMeshProUGUI object (the target text element).
  2. A string containing the text to display.

The coroutine writer() appends one character at a time to the target text element, waiting a configurable amount of time between each update.
By default, each character appears every 0.1 seconds, but you can easily adjust this value.


✅ How it looks

demo


💻 Example Usage

usingUnityEngine;usingTMPro;usingSystem.Collections;publicclassExampleUsage:MonoBehaviour{publicTextMeshProUGUItextUI;privateStringWriterstringWriter;voidStart(){// Create a new StringWriter instance with the target text object and messagestringWriter=newStringWriter(textUI,"Hello, this is a typewriter text effect!");// Start the coroutine at 0.05 seconds per characterStartCoroutine(stringWriter.writer(0.05f));}}

About

A lightweight C# class for Unity that animates text in a typewriter style using TextMeshPro. Displays text letter by letter with adjustable speed — perfect for dialogue boxes, story scenes, or UI effects. Simple, efficient, and fully open source under the MIT License.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages