Forum rules - please read before posting.

Enable/disable scrolling text

Hello! I have a bit of a unique problem. On some dialog, I want to be able to disable scrolling, and on others, enable it. There doesn't really seem to be a way to do this, unless I'm mistaken?

The reason I'm asking is kind of complicated so feel free to ignore this part. Ideally, I would want to be able to create a "Phone interface" that looks like a cellphone messaging screen where the characters are texting one another. But I just don't have the coding know-how, and my experiments trying to force the Inventory system to do that kind of thing didn't work. So I've settled for just displaying one text message at a time in a Menu that's separate from the Subtitles menu, since I can use AC's built-in Dialog actions without too much trouble. It works, except that it only looks like a text message if scrolling is off — but for regular dialog, I would prefer it on.

Anyway, I hope there is some solution for this, if not, worst case scenario is that I just disable scrolling for all the dialog. Thanks for reading. :)

Comments

  • Any Manager field can be modified at runtime through script - just right-click on the field's label to get an API reference to it. In the case of the **Scroll speech text?* field, it's:

    AC.KickStarter.speechManager.scrollSubtitles
    

    You can then use this in a pair of functions that can set it to true and false, i.e.:

    using UnityEngine;
    
    public class SetScrolling : MonoBehaviour
    {
    
        public void EnableScrolling ()
        {
            AC.KickStarter.speechManager.scrollSubtitles = true;
        }
    
        public void DisableScrolling ()
        {
            AC.KickStarter.speechManager.scrollSubtitles = false;
        }
    
    }
    

    Paste that into a C# script named SetScrolling, attach it to a GameObject and then make it a prefab. You can then use Object: Call event Actions to reference this prefab and trigger either the EnableScrolling or DisableScrolling to set the state of scrolling as/when necessary.

  • Wow, thanks so much for the quick reply — and the script. :) I did as you instructed but unfortunately it didn't work — there's an error on the action in question that says "Parameters passed from here cannot be set, unfortunately, due to a Unity limitation."
    Does that mean I need to contact Unity Support?

  • No - I purposefully avoided using parameters in the script to get around that issue.

    Have you assigned the prefab into the Action's UI? Be careful not to assign the script itself - you need to refer to the component on the prefab itself.

  • Hmm! When I assign the prefab, then go to select SetScrolling > DisableScrolling (), it automatically switches to the script, not the prefab as soon as I select it.

  • Can't imagine why that would be.

    But as an alternative, you can use the Object: Send message Action. Again, assign the prefab, and set the Message to send as Custom, then enter the name of the function into the text box.

    You may need to place the prefab into the scene and reference that instead, but try it as a direct prefab first.

  • Huh... that didn't work either! (Neither did placing the prefab in the scene, with either method) :(
    Here's a screenshot, did I set everything up right?

  • Maybe this will help — I watched the "Scroll speed text?" checkbox in the Speech manager during gameplay and it DOES appear to switch off after the "Send message" action. But that doesn't actually translate into the gameplay and the text keeps scrolling. Maybe it's just something that can't be set during gameplay?

  • At what point are you calling this Action to update it? It should be called before any speech Action you want to scroll / not scroll.

    Also, this affects speech lines that have a character assigned. Narration lines, i.e. those with no character, rely on a separate field. These lines are all spoken by characters?

  • Ah!! That was it. I thought by selecting "Player line" it would switch to a character line and not a narration line, even if I didn't have a Player prefab yet — but after assigning a prefab, now it works! Thank you so much for your help :)

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.