Custom text effects in Unity with TextMeshPro, in like 130 seconds!

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey I'm Josh and I'm going to show you how to manipulate text like this with unity and the text mesh Pro module on your game object with a text next component add a new script component and call it something like wobbly text ad using TM Pro to the top of the file then make a public TMP text property called text component then drag the text mesh Pro component into that slot in the inspector text mesh Pro works by creating one little for vertex mesh per character so what we need to do is intercept those generated meshes and modify them in the update method called text component force mesh update to make sure that the mesh is used by text mesh crop to date let's just store text component dot text info in a variable because we are going to use it a lot next make a for loop where I goes from 0 to text info dot character count minus 1 like so grab the entry of text info character info at index I and store that because it's also going to be used a lot and will skip any invisible characters by checking if chart info dot is visible is false now this isn't just one unity mesh instance per character we're talking about but all the characters that share a given unity material are combined into one mesh each each four consecutive vertices in this mesh represent an individual character so next grab the vertices from the mesh associated with the current character's material and put them in a variable called verts then make a loop where J goes from zero to three one loop for each of the four vertices of the character let's store the current position of that vertex by indexing verts at chart info vertex index plus J then overwrite that entry in the verts array with a modified version what I've typed here is just an example but feel free to copy it I won't judge the mesh info object acquired from text info dot mesh info actually contains two copies of the vertices which you can think of as a draft copy and a working copy so far we have modified the draft copy so we need to update the working copy to match loop over each entry of text info dot mesh info with I as the index and go mesh info mesh vertices equals mesh info vertices then go text component update geometry with mesh info and I as the arguments and that's it now we have Wiggly text there's pretty much no limit to what can be modified with this technique subscribe and follow me on Twitter pretty please and like this video to keep me motivated
Info
Channel: Kemble Software
Views: 45,045
Rating: undefined out of 5
Keywords:
Id: FXMqUdP3XcE
Channel Id: undefined
Length: 2min 31sec (151 seconds)
Published: Fri Jul 17 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.