Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Not able to make animated text

A topic by rangerpowerx created 2 days ago Views: 70 Replies: 10
Viewing posts 1 to 6

Hello! I was able to make text using king color effect for example:

SuperTextMesh_0.text = "<c=king>" + "<b>" + SuperTextMesh_0.text + "</b>";


But when i try to apply an animation like i saw in the video, example...


<j>text</j>  the text does not play the animation, i tryed many ones, including <w=sassy=Text</w> but again, the animation dont play in the text...what i am missing? 


Can i know the already included text animations by default?

Developer

In the top-right corner of any Super Text Mesh inspector window, click the [T] icon to open the Text Data Inspector, and in there you can see all of the included animations, and make new ones! I'm guessing you already know about this since you made your own color data, but it's worth mentioning, anyway.


As for why it's not animating, there's a chance that you may have encountered an import error, make sure to import all the default assets, and then in that Text Data Inspector window, click the "Refresh Database" button at the bottom.

In this window, also ensure that under the "master" foldout, that "disable animated text" is false. There's a variable for this on every Super Text Mesh object, too, under the "Timing" foldout.

Additionally, make sure your text has "ignore time scale" set to true, your game's timeScale value can effect animated text, too.

I find that some versions of Unity will show the mesh animating in edit mode, but does it work in play mode for you?

My case requires a different approach since i am doing everything through code, could you accept my friend request at discord so i can show you? I am ranger there too!

Developer

Ah sorry, but by a personal policy, I only do support through emails or the forums. (Call me old-school, but my brain will split in two if I have to dig through discord channels for support cases...)


What do you mean you're trying to do everything through code? Creating new data objects, viewing which ones exist, or seeing why it's not animating...? I feel I'm not understanding the issue properly, so what exactly are you trying to do?


If you're trying to create data objects or see which ones exist, please use the Text Data inspector, or alternatively find the folders within "Assets > Clavian > SuperTextMesh > Resources" in your project to see all the data objects there. If you add/remove any data objects that way, please keep in mind you need to go into the Text Data inspector after to press the "Refresh Database" button anyway.


If you mean you're trying to create data as your project is running... someone has done that for quads before, which i will link here: https://itch.io/t/2579008/loading-quad-images-at-runtime ...But I just don't see the use for using this for effects like waves and jitters, since those go across multiple characters. You're more than welcome to try it, though!


Additionally, you can create scriptableObjects with code, save them to the appropriate folders (although personally I use Unity's AssetDatabase code for this, which will not run in a build, only in-editor!), and then call superTextMesh.data.RebuildDictionaries() to have them be usable by SuperTextMesh objects. (The quad example above bypasses this by writing the data object to a specific character as the text is reading)

Nono, i do EVERYTHING in the code, example for changing fonts and adding effects, in this many hours i managed to do it, i will show you:


I have to say that your resource is very complete!



Also i wanted to ask, does it support emojis? i know it support symbols, like text symbols, but colored emojis like... "馃榾馃槣" if so, how could i add them?

(2 edits)

Developer (1 edit)

Oh, interesting... May I ask what "UTMJitterData" is? Your own variant on STMJitterData?


And as long as it works for you, that's good! I always keep my code exposed so people can customize it as they see fit. I suppose this way, if you're more used to editing code than using the inspector interface, you can just change values in here to edit your effects!


Emoji support unfortunately can't be included by default until Unity figures out how to render emoji in their inspector windows... but you're not using inspector windows, so this code may be useful to you: https://pastebin.com/qr9me3GA


Just follow the steps in the start of the file with how to organize your folders with the emoji textures, and this *should* work. The code is similar to what you're doing, where it will create a quad texture dynamically as an emoji is requested. You just add the script as a component to whatever object has SuperTextMesh to add this emoji functionality.


You can also just use quads directly to insert emoji or whatever other symbol without needing to convert it from an actual emoji character, first. (That might be good, because that awful, long regex string is all I could find in terms of detecting if a typed character is an actual emoji)


You may have to uncheck "remove emoji" which is under the "Beta" foldout in the SuperTextMesh inspector. This boolean is there because trying to use emoji directly with the inspector was causing so many problems, I just disabled it since STM can't render native emoji anyway.

Uh, awesome! 

So with this file, downloading this emoji resourced and placing them in my game folder, will make it display the emojis using SuperTextMesh when an emoji is inserted? i mean, lemme explain, when  you copy a normal emoji it and paste, example from here -> https://emojicopy.com/

it displays.

So for what is this code from, it will do automatically, but what i need is to display them in nicknames and titles, example above head.


Whats the best approach?

Developer

Yeah, when that extension is set up properly, you would using code like...

superTextMesh.text = "Look at my emoji! 馃檪" and what it does is... I have a "preparse" event within SuperTextMesh that it uses, and this event is designed for methods you want to have modify the string after they've been sent to the text mesh, but before the text mesh actually evaluates the string. (This is also great for adding custom tags, check out the "links" example scene for some code with that)

So what it does is turns the above string into something more like "Look at my emoji! <q=emoji1234>" while dynamically creating a quad for the emoji at the same time, so the mesh can render it.


So this would work for you since you're going straight from code. You can just type emoji directly, send it directly to the text mesh, and have it be directly interpreted.

---

When you say "display them in nicknames and titles", do you mean you want to type the emoji more like :smiling: or <q=smiling>...? If that's the case, you can define whatever emoji you want your project to have either in the Text Data editor, or with your custom code you showed me which basically does the same thing to make STMQuadData objects with whatever name you want.

Then, if you don't want to type <q=smiling> and instead something like :smiling: or ":)", you can use the PreParsing event, just like the emoji one I sent to edit your script for you.

e.g. stringToBeSentToMesh = originalString.Replace(":)", "<q=smiling>");

...Like that, but more dynamic!

(5 edits)

Hey! Everything is good but seems some not recognized error thrown:

3 errors on those, why can be those? maybe i am missing OnPreParse and STMTextContainer? i think so, hope you can get me those ones! (I am using unity 5.5.5p2 by the way)


I also did call the method like this, should be okay right? (In Nickname_Controller.cs)


        // Add STMEMoji

        if (gameObject_1.GetComponent<STMEmoji>() == null)

        {

            gameObject_1.AddComponent<STMEmoji>();

        }


Edit: I managed to fix the errors, but after trying to use it like in your example:

        if (text.Contains("Ranger"))

        {

            text = "<c=king><b>" + text + "</b></c> 馃檪";

        }


Then, the name dissappears in game after using the emoji, like its not supporting it...maybe i did call it incorrectly?
And yeah, emojis are added:



Modified class:

Pastebin

Developer

1. I know you said the issue is resolved, but that could be caused by either an older version of STM, or needing to refresh intellisense in your IDE. Since you're using Unity 5.5.5p2, it's probably that the asset store served you an older version of STM. They don't allow me to upload from Unity 5.3.4 anymore (I still develop in Unity 5.3.4 for maximum compatibility!), so you need to install a more recent version of Unity to get the asset, then move the files to your older project.


2. Honestly the way you're doing this is so baffling to me, and I would just use Unity's inspector to add the component since this is... Unity. Since you're adding a component through code and this is all very customized anyway, what you can do is edit STMEmoji to be a static class, and just subscribe your Super Text Mesh object directly to the "ReplaceEmoji" method, instead of replying on OnEnable and OnDisable to do the subscribing, which may or may not happen in the same frame, and are dependant on script execution order.


3. You didn't follow the steps at the start of the script properly... The folder containing your emoji files *needs* to be named "Resources" (This can be anywhere in your project) so that the Resources.Load() call that happens in the script is able to find them by name. You're welcome to try other methods for grabbing the files without using the Resources folder method, but I couldn't tell you what they are!