Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(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

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!