Removed Delay and added "@{{end}}" to the last two commands. Sequencer commands will all try to run at the beginning of the sequence unless you specify some kind of timing using "@".
Added "required" in front of the last two commands. This ensures they run even if the player cancels the subtitle before the {{end}} time is reached.
You may find it simpler to write custom sequencer commands for ShowGif and HideGif that would parallel your custom Lua functions. Sequencer commands are actually easier to write than Lua functions. This way you could shorten your Sequence to something like:
CodePrincess wrote: ↑Sat Oct 27, 2018 5:29 pmIs it possible to make a custom sequencer script that takes parameters?
Yes, as many parameters as you want. In the Start() method, read parameters using GetParameter(#) where # is the parameter number, starting from 0. This will return the parameter's string value. To get bool, int, or float values, use GetParameterAsType(#) such as GetParameterAsBool(#). You can also use GetSubject(#), which will return a transform. The API reference is here. Here are some examples:
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using OldMoatGames;
using PixelCrushers.DialogueSystem;
namespace PixelCrushers.DialogueSystem.SequencerCommands
{
public class SequencerCommandHideGif : SequencerCommand
{
public void Start()
{
// Command syntax: HideGif(index)
int index = GetParameterAsInt(0);
GifManager manager = FindObjectOfType<GifManager>();
manager.Gif[index].enabled = false;
Stop();
}
}
}
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using OldMoatGames;
using PixelCrushers.DialogueSystem;
namespace PixelCrushers.DialogueSystem.SequencerCommands
{
public class SequencerCommandShowGif : SequencerCommand
{
public void Start()
{
// Command syntax: HideGif(index)
int index = GetParameterAsInt(0);
GifManager manager = FindObjectOfType<GifManager>();
manager.Gif[index].enabled = true;
Stop();
}
}
}
And this is how I use the commands in the Sequencer field:
I added two lines of code to each: (1) Shows a debug message, and (2) Activates/deactivates the GameObject in addition to enabling/disabling the gif player component.
You'll want to import import the test in a separate project. Otherwise the scripts will conflict with yours that have the same name.