Super Text Mesh Integration

Announcements, support questions, and discussion for the Dialogue System.
alfa995
Posts: 30
Joined: Mon Dec 03, 2018 11:31 pm

Super Text Mesh Integration

Post by alfa995 »

I recently bought Dialogue System and it seems great so far! I also got another asset called Super Text Mesh (not to be confused with Text Mesh Pro) which basically allows the use of inline tags for text animations, effects, etc. https://assetstore.unity.com/packages/t ... mesh-57995

I figured being able to use them together would be really powerful, but since STM is a bit obscure there's no integration for it, like there is for Text Mesh Pro. I thought I'd at least make an attempt at it.

I tried creating a custom UI based on one of the template prefabs and use a STM component instead of the regular Text UI, create a new script with StandardUISubtitlePanel as an interface and reference the STM component, so I could do any necessary overrides later, but it doesn't show up in the Inspector. Apparently it needs to use MonoBehaviour but it can't have 2 base classes.

To be honest I'm just not sure what to do or if it's even possible, I'm new to both assets and not that great at C# to begin with so it feels out of my reach. Hope there's a way to get this to work.

Thank you in advance.
User avatar
Tony Li
Posts: 22056
Joined: Thu Jul 18, 2013 1:27 pm

Re: Super Text Mesh Integration

Post by Tony Li »

Hi,

Thanks for buying the Dialogue System!

(Apologies in advance; wall of text incoming.)

The Dialogue System is GUI system-independent, which means you can plug in code that works with any display system (such Super Text Mesh) and the rest of the Dialogue System (data model, variables, quests, etc.) will work happily with it.

It does this by working with a C# interface named IDialogueUI. You provide an implementation of IDialogueUI, and the rest of the Dialogue System will just work with it.

The Dialogue System ships with a few implementations of IDialogueUI. The default implementation is named StandardDialogueUI. The Third Party Support folder contains packages with other implementations for NGUI, TextMesh Pro, etc. (TextMesh Pro support is also built into StandardDialogueUI. The Third Party Support package for TextMesh Pro is there for legacy support, from before StandardDialogueUI had built-in support.)

The most direct way to use Super Text Mesh is to copy the file Templates / Scripts / TemplateDialogueUI.cs, which is a commented starter script for IDialogueUI. Fill in the code where indicated to use Super Text Mesh.

If you want to start with something that's more built out, you could unpack the Third Party Support / TextMesh Pro Support unitypackage, copy those scripts, and essentially just replace all mentions of TextMeshProUGUI with the corresponding Super Text Mesh component name.

That said, I really like your idea of creating a subclass of StandardUISubtitlePanel. This gives you all the functionality of StandardDialogueUI. In your subclass, add public variables for Super Text Mesh components. Then override the SetContent() method to set your Super Text Mesh components instead of the original UITextField (which points to a UI Text or TextMeshProUGUI component).
alfa995
Posts: 30
Joined: Mon Dec 03, 2018 11:31 pm

Re: Super Text Mesh Integration

Post by alfa995 »

Hi, thank you for responding so quickly!

I tried duplicating the Text Mesh Pro scripts and replacing the components like you mentioned. Good news is, the inline text effects and animations all work as expected! Bad news is, the actual UI animations are messed up and I can't get the typewriter effect to work.

Super Text Mesh already has a typewriter effect and for simplicity I wanted to use that one, but whenever I enable it it throws an error, saying it can't start the coroutine because the subtitle text is inactive. I'm guessing it's an issue with the animations? maybe it's trying to access the component before the animator enables it?

I also can't get the response menu to show up, but maybe I should just create a new, simpler UI from scratch to test. Again I'm really new to the asset so I haven't even gotten into UI animations or creating my own UI.

Also unrelated but quick question. Is there a way to delete conversations?

Thank you!
User avatar
Tony Li
Posts: 22056
Joined: Thu Jul 18, 2013 1:27 pm

Re: Super Text Mesh Integration

Post by Tony Li »

Hi,
alfa995 wrote: Tue Dec 04, 2018 11:31 pmI tried duplicating the Text Mesh Pro scripts and replacing the components like you mentioned. Good news is, the inline text effects and animations all work as expected! Bad news is, the actual UI animations are messed up and I can't get the typewriter effect to work.

Super Text Mesh already has a typewriter effect and for simplicity I wanted to use that one, but whenever I enable it it throws an error, saying it can't start the coroutine because the subtitle text is inactive. I'm guessing it's an issue with the animations? maybe it's trying to access the component before the animator enables it?

I also can't get the response menu to show up, but maybe I should just create a new, simpler UI from scratch to test. Again I'm really new to the asset so I haven't even gotten into UI animations or creating my own UI.
You may find it simpler to use the Standard Dialogue UI and make subclasses of StandardUISubtitlePanel, StandardUIMenuPanel, and etc. In fact, give me an hour or so and I'll see if I can whip that up for Super Text Mesh.
alfa995 wrote: Tue Dec 04, 2018 11:31 pmAlso unrelated but quick question. Is there a way to delete conversations?
Right-click on blank canvas space in the conversation node editor. This will open a context menu. Select Delete Conversation.
User avatar
Tony Li
Posts: 22056
Joined: Thu Jul 18, 2013 1:27 pm

Re: Super Text Mesh Integration

Post by Tony Li »

Hi,

Here's a work in progress support package that should get you started:

SuperTextMesh_Support_WIP_2018-12-05.unitypackage

I had to email the developer because I noticed a couple issues with Super Text Mesh and Unity UI. I'll update the support package when he gets back to me, hopefully with bug fixes or workarounds. In the meantime, these are the issues:
  • Super Text Meshes do not render inside Scroll Rects. In the example scene, I used an explicitly-defined button list instead of a Scroll Rect of instantiated buttons.
  • Super Text Meshes block the mouse cursor. If you use a Super Text Mesh as a button label, it will block the mouse cursor from being able to click on the button. For the time being, you can click on areas of the button that aren't covered by text.
alfa995
Posts: 30
Joined: Mon Dec 03, 2018 11:31 pm

Re: Super Text Mesh Integration

Post by alfa995 »

Oh wow I wasn't expecting a support package for it already, thank you for spending the time to work on it! Yeah there's still a few limitations and bugs with STM and the Unity UI, and hopefully the developer will get in touch for possible fixes to improve the package.
User avatar
Tony Li
Posts: 22056
Joined: Thu Jul 18, 2013 1:27 pm

Re: Super Text Mesh Integration

Post by Tony Li »

I got a reply from the developer. He wasn't sure, but he gave me some ideas to try. I should be able to post some kind of update later today.
User avatar
Tony Li
Posts: 22056
Joined: Thu Jul 18, 2013 1:27 pm

Re: Super Text Mesh Integration

Post by Tony Li »

The response button issue was my fault, not STM. To fix it, inspect the Text Field UI GameObject. Deactivate the child GameObject named Text Field Panel.

The issue with STM and Scroll Rects still exists. For now, you'll need to use predesigned buttons or, if you use an instantiated button template, remove the Scroll Rect from the button container. I updated the example scene in the unitypackage (linked above) to use a button template. The STM developer said he'd look into this further and try to implement a solution for Scroll Rects.

In the future, I'll also implement STM versions of the quest tracker HUD, quest log window, and selector UI.
alfa995
Posts: 30
Joined: Mon Dec 03, 2018 11:31 pm

Re: Super Text Mesh Integration

Post by alfa995 »

I see! Yeah the buttons work ok after deactivating the Text Field Panel.

The instantiated button template you included works great and looking forward to any updates to get Scroll Rects and the rest of the UI working.

Again thank you so much for all your help with this so far! When I made the forum post I expected maybe a few suggestions on how to integrate the asset myself but I didn't expect you to take the time to make the package and even contact the STM developer to check on the other issues. It's only been a few days since I got Dialogue System but I already feel like it's one of my best purchases simply because of the amazing support!
User avatar
Tony Li
Posts: 22056
Joined: Thu Jul 18, 2013 1:27 pm

Re: Super Text Mesh Integration

Post by Tony Li »

Glad to help! You weren't the first to ask for STM support, so I figured I might as well get to it. :-)
Post Reply