Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles

KaiClavier

160
Posts
6
Topics
222
Followers
37
Following
A member registered Jul 23, 2014 · View creator page →

Creator of

Recent community posts

Patch should be up now (v1.8.5) as long as nothing goes wrong!

No problem! If you want the build right now, drop me an email and I'll give you the .unitypackage. It'll be at least another 2 days before the patch goes up, as the asset store is giving me some strange issues with the automatic vetting process.

(1 edit)

Hey,


The above preparsing code only searches for <transcribe> once in a mesh, since I figured you'd have a single character talking this way and wouldn't need it to happen multiple times. Here's a modified Parse function that loops until all <transcribe> tags are cleared:


public void Parse(STMTextContainer x)
    {
        string startTag = "<" + textTag + ">";
        string endTag = "</" + textTag + ">";
        int startingPoint;
        int endingPoint;
        do
        {
            startingPoint = x.text.IndexOf(startTag);
            endingPoint = startingPoint > -1 ? x.text.IndexOf(endTag,startingPoint) : -1; //get tag after starting tag point
            //optional, where this tag ends
            if(endingPoint == -1)
            {
                endingPoint = x.text.Length;
            }
            else
            {
                //remove tag
                x.text = x.text.Remove(endingPoint, endTag.Length);
                //ending point is already accurate
            }
            //if this tag exists in STM's string...
            if(startingPoint > -1)
            {
                //remove tag
                x.text = x.text.Remove(startingPoint, startTag.Length);
                //push backwards
                endingPoint -= startTag.Length;
                //actually modify text
                Replace(x, startingPoint, endingPoint);
            }
        }
        while(startingPoint > -1);
    }

Hey,


Yes, in the current build on the asset store, </v> causes an error, but I'm currently waiting on the asset store to upload my fix to that. The change I made was that I changed line 1884 in SuperTextMesh.cs to "myInfo = new STMTextInfo(this);"


Here's a modified Replace() function for the above code that will work together with other tags:


void Replace(STMTextContainer x, int startingPoint, int endingPoint)
    {
        //int originalLength = x.text.Length;
        int skippedChars = startingPoint;
        bool parsingOn = true;
        //go thru string
        for(int i=startingPoint; i<endingPoint; i++) //for each letter in the original string...
        {
            
            string replaceValue = x.text[skippedChars].ToString(); //default value             if(replaceValue == "<")
            {
                //turn off parsing
                parsingOn = false;
            }
            else if(replaceValue == ">")
            {
                //turn back on
                parsingOn = true;
            }
            //is this a letter that should be replaced?
            if(parsingOn)
            {
                //replace specific characters with sequences
                //for this example, compare all letters as uppercase letters
                switch(x.text[skippedChars].ToString().ToUpper())
                {
                    case "A": replaceValue = "aaa"; break;
                    case "B": replaceValue = "bbb"; break;
                    //etc etc...
                }
                //remove original character
                x.text = x.text.Remove(skippedChars, 1);
                //replace with sequence
                x.text = x.text.Insert(skippedChars, replaceValue);
            }             //1 by default, but adds up if more characters are inserted
            skippedChars += replaceValue.Length;
        }
    }

Hey, this is a known bug. Patch is already up on itch.io, but the asset store is having issues with automatic asset reviewing so the patch hasn't gone up there yet.

Each of those lines has a commented line above it, if you swap those lines out, it should work.


Sorry for the trouble!

(1 edit)

Found a bug with it, but the tag </v> should cancel all tags already. I'll publish another update that fixes this.


I thought about using custom events for this, but the usage of events is very different than what we're after. I really think it'll be better to use preparsing.


I wrote up some working code that does what you need:


using UnityEngine;
using System.Collections;
public class STMPreparse3 : MonoBehaviour {
    public string textTag = "transcribe";
    public void Parse(STMTextContainer x)
    {
        string startTag = "<" + textTag + ">";
        string endTag = "</" + textTag + ">";
        int startingPoint = x.text.IndexOf(startTag);
        int endingPoint = startingPoint > -1 ? x.text.IndexOf(endTag, startingPoint) : -1; //get tag after starting tag point
        //optional, where this tag ends
        if(endingPoint == -1)
        {
            endingPoint = x.text.Length;
        }
        else
        {
            //remove tag
            x.text = x.text.Remove(endingPoint, endTag.Length);
            //ending point is already accurate
        }
        //if this tag exists in STM's string...
        if(startingPoint > -1)
        {
            //remove tag
            x.text = x.text.Remove(startingPoint, startTag.Length);
            //push backwards
            endingPoint -= startTag.Length;
            //actually modify text
            Replace(x, startingPoint, endingPoint);
        }
    }
    void Replace(STMTextContainer x, int startingPoint, int endingPoint)
    {
        //int originalLength = x.text.Length;
        int skippedChars = startingPoint;
        //go thru string
        for(int i=startingPoint; i<endingPoint; i++) //for each letter in the original string...
        {
            string replaceValue = x.text[skippedChars].ToString(); //default value
            //replace specific characters with sequences
            //for this example, compare all letters as uppercase letters
            switch(x.text[skippedChars].ToString().ToUpper())
            {
                case "A": replaceValue = "aaa"; break;
                case "B": replaceValue = "bbb"; break;
                //etc etc...
            }
            //remove original character
            x.text = x.text.Remove(skippedChars, 1);
            //replace with sequence
            x.text = x.text.Insert(skippedChars, replaceValue);
            //1 by default, but adds up if more characters are inserted
            skippedChars += replaceValue.Length;
        }
    }
}

This code ignores other tags (which shouldn't overlap with this edge case anyway), but you can define a starting and ending point using <transcribe> and </transcribe> or whatever you change the textTag value to.

Hey,


A tag that uses a custom parser isn't the worst idea, but preparsing already allows for full text customization with custom tags. I'll see what I can do, though.


Yeah, the voices are just a collection of multiple tags. <v=myVoice> just puts <c=myColor><w=myWave><etc> into a string. I can't believe I don't have some type of <clearAllTags> tag, yet. That would solve that, so I'll get on it.


Also yeah, I just wrote that sample code as pseudo code right in browser, I didn't test it.

Managed to code it in, auto delays, auto clips, and sound clips all work together with quads, now. If that means everything is solved, I'll publish this update and I can email you a build.

(4 edits)

Now that I see it laid out this way, I think Pre-parsing might be the way to go for your solution.

You'd have to set up a script that interprets your text, maybe something like this:

public void Parse(STMTextContainer(x))
{
    //go thru entire string
    for(int i=0; i<x.text.Length; i++)
    {
        string replaceValue = x.text[i]; //default value
        //replace specific characters with sequences
        switch(x.text[i])
        {
            case "A": replaceValue = "<c=cyan><q=CIRCLE>"; break;
            case "B": replaceValue = "<c=cyan><q=CROSS>"; break;
            etc etc...
        }
        //remove original character
        x.text = x.text.Remove(i);
        //replace with sequence
        x.text = x.text.Insert(i, replaceValue);
    }
}


That way, when you send the text "HELLO WORLD" to a mesh, it'll just convert it to quads, itself! If you need help writing this code for this, just let me know.



Also oops, looks like that's a typo... On line 8 of STMAutoClipData.cs, I call it "Sound Clip Data" instead of auto clip data. I'll make sure this is changed in the next update! That said, you can create new Auto Clips thru the text data inspector. (The menu that shows up when you click the [T] in the top right of any super text mesh inspector. It'll be under "Inline > Sound Clips" or "Automatic > Auto Clips"

Hey!


STM audio clips and STM sound clips are actually different things. Sound clips are the same as auto clips, but you can call them with a tag, so I thing that's what you're looking for. (There's a typewriter example in there that puts a "ding" sound when return is pressed)


Would it be possible to tell me the exact effect you want your text to do? Even before I add quads to auto clips/sound clips character list, the effect you're after might already be possible.

Hey!



Quads can already be multiplied by a colour set in the inspector! Just make sure to check "silhouette" in the quad's settings. This makes it so the quad is treated like any other character in the mesh, so it gets coloured in the same way regular characters do. Works with animated quads, gradients, textures, everything.


***


Good point about quads not having a character in place for custom sound clips. The way internal sound clips works is pretty limited in this regard, so it might be better to get this working through an extension. I was planning on making the audio system more open-ended in a future update, so I think this will be the solution:

I'm going to be adding a unity event that gets invoked every time a sound clip is supposed to play, and that event can be extended in any way, either for support with other middleware like FMOD, or for specific instances like this. I'm imagining for quad output it could work as follows...

Every time a sound is supposed to play, check if the character is "\u2000" (This is a unicode character assigned to quads), and if so, check the data attached to this letter to figure out what the original tag was. (<q=myQuad1> vs <q=myQuad2>) Then using this infor, you can play the appropriate sound.


That said, I'll see if I can extend the sound clips class a bit. It's already got support for typed-out characters like "line break" and "space", so I think I'll be able to have it also check for matches with quads.


***

I think you might be confusing STM's voice system with something else? It's sorta just a renamed text macro system because <m> was already used for materials and <v> was free.

The whole idea behind STM's voices is that they get replaced with other text, even other tags. So if you have a voice named "small" defined as "<s=0.1><c=yellow>" then typing <v=small> will essentially place both of those tags there at once, and you'll get small, yellow text.

I could expand the sound clips class to include colour/effects, as one way to do it. So... it would be like a per-character tag for voices. You might also be able to solve this with Preparsing! I can send some sample code, but with preparsing, you can set up custom tags that get parsed before STM even attempts to parse text. So... you could set up a <mySpecialTag> thing and have it automatically put a colour tag before every character so you don't have to.



This one's a bit tricky to think about, but per-character voices are a neat idea and I don't think they'd be that hard to implement. I'd just have to put them in the same place as my current code for sound clips, I think. It could pair together with the above sound clip idea.


***


STM currently uses the resources folder to queue up effects. The way unity works with Resources, if an asset is in *any* folder named "Resources", unity considers it to be within resources. My default wave effect is stored at "Assets/Clavian/SuperTextMesh/Resources/STMWaves/default.asset", but if you were to store it at "Assets/MyAssets/Resources/STMWaves/default.asset", Unity doesn't see the difference. Just make sure to put it in a folder called "STMWaves" or whatever the appropriate class is. This division is here because... when Unity tosses everything into one Resources folder, it would be really annoying to tell the different classes apart without the subfolders. I also don't want this interfering with other assets that might use the Resources folder.

You're free to delete the sample effect files, by the way! All of them except the "default" ones aren't needed.


***


Anyway, I hope that helps. For now, you might be able to extend STM using  preparsing or the OnPrintEvent() for image effects and audio, respectively.

Last-minute thought about randomized colours tho: Try using a rainbow gradient, had try turning off "smooth gradient" and setting it to repeat often. That should give a randomized colour effect pretty quickly.

Hey! I published the new shaders in v1.8.2. That's up on itch already, and should be on the asset store shortly.

(1 edit)

Update for transparency's sake: This should be solved in 1.8.2!

Essentially, <e><pause><e> actually ends up sticking two events on the same character, and both were being skipped. So now, as STM already does when an event is alone at the end of a string, it adds a zero-width space to hold the event on.

Hey! Got an update on this.

In an empty scene with just a single STM object in it:


Old UI shader: 4 batches

Unity's GUI/Text Shader: 2 batches

New UI Shader: 2 batches


So, that's that! The new shaders are in v1.8.2, and that's out on itch already and will be on the asset store when it gets approved.

Awesome, already published this update!

Oh heck, nice catch. I think I get what you mean... another scene is loading, and this calls the OnSceneLoaded() delegate event in Super Text Mesh, which then tells super text mesh to Rebuild, regardless of if it was actually in that new scene or not!


Could you revert your code to what it was before, and change the IEnumerator "WaitFrameThenRebuild" to this:


IEnumerator WaitFrameThenRebuild(){
        yield return null;
        Rebuild(currentReadTime, autoRead);
    }

The mesh will still rebuild itself, but it should remember where it last left off with this method. Please tell me if this fixes your issue!

(1 edit)

Hey!


Good catch, looks like the pivot point wasn't respecting quads.

In the script "STMTextInfo.cs" if you replace the "RelativeWidth" accessor with this:

public float RelativeWidth{ //width of this letter
        get{
            if(isQuad)
            {
                return quadData.size.x * (size);
            }
            else
            {
                return chMaxX * (size / chSize);
            }
        }
    }

That should fix it! I'll make sure this gets out in the next patch.

Update on this: The shader works!! I'm just cleaning it up right now, the new shaders are gonna be reallll good

Hey!


Nice catch with the duplicated custom event, deleted that now.

Yeah, this but with the event isn't supposed to happen... I'll take a look and see what changed between the two versions. In v1.8 I fixed a bug where the first event/sound played by a mesh would ignore an initial delay, so it might be related to that part of the code. SInce it worked in the past, I'll be able to look at older code and get it running again!

I'll admit I have a bit of a queue of things to fix right now, but I'll keep you updated for when I've fixed the bug!

Hey!

If this is in a sample scene, did you import the fonts that came with STM? I believe this mesh is trying to reference a font that doesn't exist in your project. Some sample scenes use a font that comes in the package, so if the font is missing that might be the cause of the error. If you click on the error, it'll highlight the mesh calling that error, and you can change the font from its inspector.

I'll try to make this problem resolve itself in the future! STM should set its font to be Arial when a requested font isn't found, but it looks like I forgot to do this for this one corner of the inspector.

Hey!

Can you email me through my website? I have a new shader for STM I'm working on, and I'd like to test to see if it solves this problem!

Hey!

It sounds like you're trying to instantiate an object with Super Text Mesh on it to a UI canvas, and you want the text to be center/right aligned, is that correct?

Please make sure you have "Ui Wrap" checked under the "position" settings. Hopefully that's the cause, it seems to match your description. In v1.7, this checkbox was essentially on by default, but led to some edge cases with how STM worked before I added compatibility with the content size fitter component. So in v1.8, I kept the new feature in as a boolean and had it turned off by default. I guess I should switch that to be on my default instead of off since that would match what most users expect, and wouldn't effect older users.

Right, the itch.io page only lets me put up one video in the sidebar, but the links to the others are further down in the description text. On the Unity Asset Store, the videos are right after the trailer.

I seriously will look into someway to making that blink that work right, but setting up multiple blinks will have to be the solution for the time being.

I could swear I made the asset paths non-static in the latest update, but now that I think about it it would have only effected the creation of the "Materials" folder. I'll see if I can apply it to creating new Textdata objects! I already have some code in there for finding the asset path no matter where it is, so hopefully this will be a quick fix.

Hey,

I've been adding more and more example scenes as STM to function as tutorials along with a few short videos, but contacting me like this is probably the fastest way to get things done!


In this last update, I was actually going to add this exact feature, making it so the "blink" tag was "additive", so it wouldn't override the colour of a mesh with its own, instead just adding to it and using the gradient's alpha as an override. I realized that this would lead to some really odd edge-cases... the blink tag is actually just a "color" tag, so that means it overrides the current active colour, anyway. I could try adding it in, but I'm just worried that it might lead to more confusion with usability down the line since STM's colour tags aren't additive, they just replace eachother when you type a new one.

I figured that in a final build of a game, typically text boxes settle on just one or two colours and the blink tag is pretty unpopular, so having two separate blink tags for this was easier than the potential confusion it might cause? But I could mess around with this and see if I get good results! I'll keep you posted for version 1.8.2!


Quads should be explained in the docs and in my tutorial video, but here's a quick rundown:

  • Inside of any Super Text Mesh component, click the rainbow "T" in the top-right corner. This will open up the "Textdata Inspector" where you can edit and create all the effects for Super Text Mesh. (This uses the resources folder you mentioned earlier, but this is an easier way to edit everything all at once)
  • Under "Inline > Quads" you can find all the quads! Click the "create new quad" button to create a new quad that you can then edit. Check out the default "anyButton" quad to see how splitting a texture across multiple quads and animated quads work!
  • After you define a quad, I suggest putting it in a mesh and editing the values right there to make sure everything is sized appropriately.

I hope this helps!

-Kai

I can send a zip thru email if you need it, but you can see it happening on the palm trees in my game: https://kaiclavier.itch.io/hammerspace

Even when I tried applying the doodleAnimationFile to a different renderer, stuff stayed in sync? I even just tried adding some numbers to the animation frames to make sure it wasn't my brain playing tricks on me, and it's all synced. And yes, it seems to be consistent across all sprites. I'm in Unity 2017.4 btw, if that makes a difference!

Hey!

I have a bunch of the same object in my scene, and they all have "Random first frame" enabled on their doodle animators, but they always seem to be in sync no matter what I do. Is there something I'm missing? I could swear I didn't have issues with this before but I could be doing something wrong.

Still looking into this, because I'm still not too sure what I could have changed that could cause a difference in this between any version? I might be able to add a padding variable or something if it persists?

This behaviour should be working correctly as of v1.8!

Sorry for the late reply! I am currently commissioning a new shader for STM, when it's good to go I can send you the beta if you drop me an email. Hopefully the shader update will fix this issue, it would be great to get your feedback to check that it actually works. The new shader will work more similarly to unity's built-in text shaders, so hopefully this will just be fixed.


-Kai

Reviewing this again as I'm fixing bounding box issues, STM is actually supposed to use a character's advance when deciding on the width of a box, so I will be changing this behaviour to work the way it should! Sorry about all this, but thank you for catching this.

Just updating this to let you know that this has been implemented for the next update. It's still going to take just a bit longer since I'm working out other bounding box issues, but I now have variables that track text bounds as the mesh reads out, the final bounds that text will have when it finishes reading, as well as an OnPrintEvent() that gets invoked every time a new character is drawn, so that can be used to update the size of a mesh.


-Kai

Hey!

In an upcoming update, I'm actually commissioning a shader update to combine all the shaders into one variable shader, so I'll forward this to my shader guy to see what can be done!


-Kai

Hey!


Since it's effecting the default Unity text too, could you post a screenshot of STM and the default text with the same font & text & size next to eachother so I can confirm it's exactly the same issue with both?

Assuming it is the same between both, the only idea I have for sharpening the text is to try out generating an SDF font (there's a guide in the docs), but the SDF shader doesn't support UGUI currently, but that might be possible with the shader changes in the next build?


Anyway, since it happens with both the standard text and STM, it might just be something unavoidable with aggressive antialiasing? Would it be possible to use a thicker font, or make the text larger?

Hey!


What font are you using, so I can try to reproduce this? Also, can you send a screenshot of your full STM inspector, specifically the "Materials" section, if you can.

By "when the game is played", do you mean it looks different in play mode? What does it look like in edit mode vs play mode?

This screenshot is cropped close, so I can't tell what the context of this is,...so I'm unsure if this is STM's fault, or if it's just basic pixel aliasing. Does the same thing happen when using Unity's standard "Text" object on your canvas? Do you have anti-aliasing enabled in Unity's quality settings? Do you have any post-processing effects enabled?

A screenshot of the full unity editor window will be helpful for me to understand the full issue!


-Kai

Hey!


If your text is middle/lower anchor aligned, this bug is the same one as this: https://itch.io/t/156485/solved-text-alignment-like-zelda-botw-mario-odyssey (near the end of the thread)


I've already fixed the alignment changing as text reads out for those anchor points, but I'm still in the middle of making the text react to being cut off correctly in those scenarios. If you want the current beta, send me an email thru my website/the asset store page! Otherwise, if you set the text's anchor to top left/right/middle, this bug shouldn't happen.

Okay yep, I'm able to repro it now. (I'm testing this with courier btw. Top mesh here is STM, bottom is UGUI)

I think this is caused by... the middle alignment only takes the width of the letter into account, not the width + advance. When I right-align a UGUI Text component, the text is not flush with the right side of the box, but with STM it is. This is a great catch, but I'm worried about changing this, since it would effect all text meshes, not just monospace fonts. I'll have to come up with a way for this behaviour to only effect monospace fonts automatically, somehow.

I'll write this down for sure, but if you align stuff to the left, it should work for your purposes for now?

Hmm... I'm having trouble reproducing this, could you post a screenshot of your editor window, including STM's inspector?

(2 edits)

Oof, good catch. Yeah, when custom events are invoked, it references the "info" array, and the "tacked-on" events as I call them have an info with no matching character in the string to reference.

You're right, a zero-width space added to the end of "hyphenedText" should be the easiest way to fix this.

if(info.Count > myText.Length){
    //add extra char to myText for tacked-on event
    myText += "\u200B";
}


I added this code to the end of the ParseText() event, right before return is called, and everything seems to work fine, now!

Oh oops, nice catch. I'll flip that!