This section explains how to use the MMFloatingText system to spawn texts in your game world

Introduction

It’s quite frequent that in a game you’ll want to communicate to the player some values on screen, at the spot where they’re relevant. This can be damage numbers, produced currencies, or even some text messages, it’s up to you!

Feel makes it easy to add floating texts that feel good to your game.

Setup

You can find an example of floating damage texts in the FeelTactical demo scene. Damage texts feedbacks require a MMFloatingTextSpawner, and in this scene you’ll find three different one (one per shooter/cube), nested under the Managers node. Each Tactical shooter has a ShootFeedbacks bound to it, and each triggers (among other things) a Floating Text feedback. Each of these targets a specific Channel, and is in turn caught one of the three MMFloatingTextSpawners (the one with the matching Channel).

  • the first spawner spawns very basic floating texts
  • the second one spawns feedback powered texts, that will play a MMFeedbacks once spawned, in this case animating the rotation, position, color and spacing of the texts
  • the third one spawns TextMeshPro floating texts

How to setup floating texts to play them via feedbacks?

  • in Unity 2019.4.26f1, create a new project
  • from the Package Manager, import Feel v2.2
  • in an empty scene (or your scene), create a new empty gameobject, name it “FloatingTextSpawner”, add a MMFloatingTextSpawner component to it.
  • in your project panel, search for the MMFloatingText prefab, and drag it into the newly created spawner, under its Pooler settings, in the PooledSimpleMMFloatingText slot
  • create a new empty object, call it “TestFeedbacks”, add a MMFeedbacks component to it
  • add a new UI > Floating Text feedback to it
  • press play, play your feedback, you’ll see a “100” text spawn every time
  • to go further, you can check the “use intensity as value” to have it apply your MMFeedbacks’ intensity to the feedback
  • you can also dynamically change the Value attribute of that MMFeedbackFloatingText component to anything you want
  • you can also use events from anywhere in your code to have the spawner emit new floating texts, using the MMFloatingTextSpawnEvent. You’ll see an example of such an event call in the MMFeedbackFloatingText class, it’s a one line call.