DMG Forge
ArticlesUnity TipsGamesAssets WIPCoursesAbout
ArticlesUnity TipsGamesAssets WIPCoursesAboutFree resources
LV 10 XP
Free resources
Now building:Me and M.A.X

DMG Forge

Unity tips, articles, assets, and devlogs for creators who want to build and finish.

AchievementsSavedSkill tree
Learn Unity and C# by Making GamesLesson 15 of 17
5 minBeginnerFree
XP0/17 · 0%
Next lesson
Course contents
  1. 🧱 Building the Foundation for Your First Game UI5 min
  2. ✍️ Let’s Make That Button DO Something5 min
  3. ✍️ Make Your UI Feel Alive!5 min
    1. 🎯 Step 1: Changing Text Style via Code
    2. 🔤 Step 2: Using String Formatting
    3. 🧪 Step 3: Animate It with LeanTween (Optional)
    4. 🧠 Recap
    5. 🧪 Mini Challenge: Reactive UI
    6. 🚀 What’s Next?
  4. 🔊 Make Every Click Sound Delicious5 min
  5. 🖱️ Project 1: Clicker Game – Your First Fully Playable Game5 min

Learn Unity and C# by Making Games / Clicker Game Project

✍️ Make Your UI Feel Alive!

Show changing game state in the UI so players understand what happened.

Project setup checklist

Before you start

  • Basic computer skills
  • A willingness to build along inside Unity

You’ll be able to

  • Reference a UI text element
  • Update text from code
  • Keep display text readable
  • You’ve got a working click counter - nice!
  • But now it’s time to go beyond boring black-and-white numbers and make your UI react to the player.

In this lesson, you’ll learn how to:

  • Format text on the fly
  • Change color and size dynamically
  • Use simple logic to make your UI feel smarter and more fun

🎯 Step 1: Changing Text Style via Code

Let’s start by making our click count look bold and colorful once it passes a certain number.

Update your script:

Example
text
1public void CountClick()2{3    clickCount++;4    5    if (clickCount >= 10)6    {7        clickText.color = Color.yellow;8        clickText.fontSize = 60;9    }10 11    clickText.text = "Clicks: " + clickCount;12}

Info

This makes the text larger and yellow after 10 clicks - perfect for small celebrations 🥳

🔤 Step 2: Using String Formatting

For better control, you can format text like this:

Example
text
1clickText.text = string.Format("Total Clicks: {0}", clickCount);

You can also use rich text tags with TextMeshPro (TMP) like , , .

Example:

Example
text
1clickText.text = $"Clicks: {clickCount}";

🧪 Step 3: Animate It with LeanTween (Optional)

If you want to animate the text size on each click:

  1. Install LeanTween from the Asset Store
  2. Add this inside CountClick():
Example
text
1LeanTween.scale(clickText.gameObject, Vector3.one * 1.2f, 0.1f).setEasePunch();

Boom 💥 – the text will "pop" every time it's updated.


🧠 Recap

  • You can style UI text dynamically via script
  • TextMeshPro supports HTML-style rich tags
  • Combine logic with visuals to celebrate progress
  • Optional: use LeanTween or DOTween for simple UI animations

🧪 Mini Challenge: Reactive UI

  • When clicks reach 20, make the text red and say “🔥 YOU’RE ON FIRE!”
  • Change the button label to “Keep Going!” once player reaches 50 clicks
  • Reset everything after 100 clicks

🚀 What’s Next?

Let’s make that click feel good. We’ll add sound effects and make the whole experience more satisfying.

🔊 Go to Lesson 16 → Playing a Sound on Click in Unity

Try It Yourself

  • Open Unity and recreate the smallest version of this lesson's main idea.
  • Change one value, name, or setting so you can see the cause and effect.
  • Use the Console or the Game view to confirm the result before moving on.

Keep it small enough to finish in five minutes, then write down what changed and what Unity showed you.

  • Reading the whole lesson before trying the first concrete step.
  • Changing multiple settings at once and losing track of what mattered.
  • Ignoring Console errors because the scene still appears to load.

Quick Check

What is the best next step after reading a lesson section?

Key Takeaways

  • UI should reflect the real game state.
  • Updating text is one of the simplest feedback systems.
  • Readable feedback makes tiny games feel more polished.

Resources

download

Project setup checklist

Use this before starting a new Unity prototype.

reference

Unity Manual

Official reference for Unity editor concepts, components, and workflows.

reference

Unity Scripting API

The fastest way to verify classes, methods, and Unity-specific behavior.

download

DMG Forge Resources

Checklists and creator resources for keeping projects moving.

Previous Lesson

✍️ Let’s Make That Button DO Something

5 min

Next Lesson

🔊 Make Every Click Sound Delicious

5 min

Back to course