Forum rules - please read before posting.

ActionList control UI elements?

edited December 2016 in Technical Q&A
Is it possible to control the appearance of AC-based UI elements with ActionLists? For example, I want a message to appear when my speech prompts finish typing their dialogue indicating that the player must click to continue to the next message. However all I can do right now is have that prompt at the bottom at all times, and the player might accidentally skip before the dialogue is finished, maybe during a wait token. If I create an ActionList for SubtitlesOn, the prompt doesn't display until after I've already clicked to continue, rather than right after the text finishes typing.

Comments

  • "SubtitlesOn" being an ActionList that runs when your Subtitles Menu is turned on?  And what is the prompt, exactly?

    You can use the Menu: Change state Action to show/hide elements within a Menu.  You could therefore create a "Click to skip" label element in your Subtitles Menu, or create your prompt in a new Menu - provided that you also set it's Appear type to Manual, you can control it's display also with Menu: Change state.

    Adjust your Menus to suit, and then create the relevent Action in a new ActionList, making sure to set it's When running field to Run In Background, so that it doesn't interfere with anything else.

    It will then be a case of running this ActionList at the correct time.  For very specific cases like this, AC has a custom event handler which allows you to run code when certain things occur - see this tutorial for more.  In this case, you'll want to use the OnEndSpeechScroll event, which is called when a scrolling subtitle line completes its scrolling, and have it run your ActionList at this time.

    Something like this ought to do it.

    Paste it in a new C# file named RunActionListWhenScrollingEnds, put
    it in your scene, and assign the "My Action List" in the Inspector.
  • I'm not sure I understand how to get this script to run. I've created an ActionList asset titled "myActionList" and I've placed the script onto an empty game object, but it's not working.
  • edited December 2016
    ummm.. this is a Unity basic.. Check the empty game object in which you put the script, if you click it, you will see the script listed as a "Component" in the Inspector. There you will get a field where you can drop the Actionlist asset. Making the actionlist have the same name as the variable/field won't do anything. You need to set it in the inspector for the object were you placed the script. 

    Anyway, I advice you to take a look at Unity's video tutorials(Topics) or any Unity series in youtube. Even if you are making games using AC, understanding how unity works is paramount. It's fine to skip any parts in the videos showing programming, but the script usage is a fundamental concept in Unity that you must know, even if you don't know or don't want to learn programming (Tons of people just copy paste scripts they find in the internet. I assure you, you don't need to be a programmer to use scripts).
  • I already know how to use Unity. The problem is that the script doesn't have a field for the ActionList.
  • edited December 2016
    Sorry, I didn't mean to sound harsh. I just really like to advice people to learn to use unity well. Anyway, your new comment shed some light, so I took a look at the script. It seems one word is missing from a statement.

    Change: 

    ActionListAsset myActionList;

    To:

    public ActionListAsset myActionList;
  • Well that fixed the script, but now there's a bug where the ActionList runs not when the full piece of dialogue scrolls, but at the first wait token. It's like it thinks that counts as a completed scroll.
  • It's not a bug, but I will add a new event for the case when scrolling speech ends but is also complete in the next release.
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.