Forum rules - please read before posting.

Interactive Text

I am trying to create clickable text within labels that are coloured differently from the main text.
Using custom text tokens to insert clickable differently coloured text into strings seems to be the best way to go.

Do the tokens allow for interaction with their value in labels?

«1

Comments

  • No, labels are "read only". To implement interactivity, you'd have to rely on Unity UI in conjunction with custom scripting. I'd recommend looking on Unity's forums for a method that works, and then implementing that separately to AC. When you have a system set up to do that, that'd then be the best time to look into having it work with AC.

  • edited January 10

    I see.

    Is it possible to interact with dialogue: speech actions through linked custom actions?
    Using a custom built action would allow for easy insertion of highlightable text into dialogue as much as tokens.

  • It all depends on the method involved, but I don't picture custom Actions being key here. Likely what you'll want is some way of copying the contents of the dialogue text to another Unity UI component that you can then manipulate as necessary.

    The OnStartSpeech event, for example, may be more suitable - see this tutorial.

    Again, though, this is something to work out separately to AC first. Working out how to then get it connected with AC (either through actions, events, etc), would be the second step.

  • A method that I am looking into now is building a modified version of the current Dialogue: Play Speech action that will process and display the dialogue as normal but will search for specified phrases within the inputted dialogue text, colour that text differently and fit a rect around it to add interaction.

    It seems to be the better method since I will be dealing with the dialogue directly.

  • I've written up an action list based on the normal dialogue Play speech action. I've found a way to capture the selected phrase, but I need to test it. I have tried to colour the text a different colour, but the normal method is not working.

    Is there another way to change the text colour in a dialogue box?

  • What do you mean by the "normal method"? As in Rich Text?

    Make sure you're using Unity UI for your Menus display, and that you're not trying to control the colour per-character via the Use character text colour? option.

  • "< color = blue >" + capturedPhrase_1 + "</ color >"
    was the way I tried to set the extracted phrase colour.

    For the NPC dialogue. I am not using character colour for the dialogue.
    If it would help, I can send you a link to the custom actions code.

  • The use of Rich Text is handled by Unity - not AC. IIRC it won't work with spaces surrounding the brackets, though.

  • Rich Text is overridden by AC menus, so could not be used.
    I'll try and rebuild the NPC Dialogue menu in Unity UI and see if that works.

  • Just remembered, is there anything in the dialogue script you sent that could stop Unity UI from displaying the dialogue menu in conversation if using UI?

    Trying it now and it won't display over the conversation menu.

  • Just tested with the ManualConversation script disabled. It seems to work as normal.

  • The UI menu, that is. It is still hidden behind the convo menu.

  • ManualConversation just controls when the Conversation menu is turned on - nothing to do with its display relative to other menus.

    Are you talking about one Menu being drawn on top of another? This sounds like a visual problem, in which case please share screenshots.

    Be aware that AC menus will always be drawn atop Unity UI ones. When two menus are drawn with AC, they'll be drawn in the order they appear in the Menu Manager. When two menus are drawn with Unity, they'll rely on the Canvas's Z position for ordering.

  • Ah, I see. I didn't know that AC menus took president over UI ones.

    So, by changing the UI z-axis, the menu will appear past the convo menu?

  • Sorry about the delay. I can't paste screenshots without a URL link

  • I tried to change the Z axis value, but its blocked off to me.

  • I can't paste screenshots without a URL link

    This forum doesn't support image hosting - imgur.com is the recommended way of uploading images to link to.

    I tried to change the Z axis value, but its blocked off to me.

    Apologies - I mean the Sort Order field in the Canvas component. See the Manual's "Menus overview" chapter for more.

  • Ah, I see.

    Thank you!

  • So there is no way for me to make a UI menu appear over an AC menu?

    In order to present both menus on screen, I will need to convert the AC menu into a UI menu?

  • So there is no way for me to make a UI menu appear over an AC menu?

    No - they use different rendering methods. AC uses OnGUI, which is the last thing Unity draws on-screen.

    In order to present both menus on screen, I will need to convert the AC menu into a UI menu?

    Only if you want the one that's currently Unity UI to appear above the one that's currently AC. All of the default menus, however, have Unity UI variants provided.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.
Do NOT follow this link or you will be banned from the site!