Spine Animation does not play when it is in the On Trigger Enter state.

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
2gold
Posts: 19
Joined: Wed Aug 18, 2021 2:56 am

Spine Animation does not play when it is in the On Trigger Enter state.

Post by 2gold »

Hello Tony!
I'm worried that I think I'm having a hard time with a simple problem. :oops:

In our game, a cut-in event may occur through On Trigger while the character is moving.
The order of cut-in events is as follows.

1. Hide UI panel
2. Run Spine Animation
3. Execute Conversation

If you run this procedure through the Dialogue System Trigger to <On Start>, it will run normally. However, when you run <On Trigger Enter>, the Spine Animation Sequence Command does not run. Can you tell me why?

The commands used are:

Code: Select all

AnimatorTrigger(Hidden,Dialogue_Def);
SpineAnimation(ListenIn,Player,0,false);
SetContinueMode(false);
Delay(2);
User avatar
Tony Li
Posts: 21977
Joined: Thu Jul 18, 2013 1:27 pm

Re: Spine Animation does not play when it is in the On Trigger Enter state.

Post by Tony Li »

Hi,

Do the other commands run? If not, the Dialogue System Trigger may not be firing. To confirm, temporarily set the Dialogue Manager's Other Settings > Debug Level to Info. Then play the scene and enter the trigger collider. Make sure the Console logs this message:

Dialogue System: Dialogue System Trigger is firing OnTriggerEnter.

If you do see that message, make sure there's only one GameObject named "Player". Also check for any errors or warnings in the Console, or anything on the Player that might prevent it from playing Spine animations.
2gold
Posts: 19
Joined: Wed Aug 18, 2021 2:56 am

Re: Spine Animation does not play when it is in the On Trigger Enter state.

Post by 2gold »

I found the cause!
This is because the sequence command of SpineAnimation was written in <START>node. :roll:
When I created an empty node and entered the command, it was able to operate normally. :D

But there is one problem.
We are using the command as follows because we need to hide the UI for the duration of the show alert display.
sample_node.png
sample_node.png (9.18 KiB) Viewed 1001 times
<> Node

Code: Select all

SetDialoguePanel(false,Immediate); 
SpineAnimation(ListenIn,Player,0,false);
SetContinueMode(false);
Delay(2);

<Next node>

Code: Select all

[Sequence]
SpineAnimation(Idle,Player,0,true)@6;
SetDialoguePanel(true)@7;
SetContinueMode(true)@9;

[script]
ShowAlert("text");
he node moves over with a delay(time) that plays the cut scene production in the Empty Node and the time required to display the Show Alert.
However, if you write it like this, an error message appears when you do SetDialoguePanel(ture) in <First script node> and the main character is not displayed:
Coroutine couldn't be started because the the game object 'Portrait Panel(PC)' is inactive!
I think Portrait does not display normally when you move to the next node and activate the Panel while the Panel is Hide. :|
When I looked for the cause, the animator on the Portrait Panel (PC) was not playing.
Using the Animator Trigger (Show, Portrait Panel (PC)) gives you the desired result.

But in a simpler way is there a way to delay ShowAlert as long as we want? We tried to use ShowAlert as a sequence command, but it didn't work. (So now it works with Script.)

Thank you always for your help!
User avatar
Tony Li
Posts: 21977
Joined: Thu Jul 18, 2013 1:27 pm

Re: Spine Animation does not play when it is in the On Trigger Enter state.

Post by Tony Li »

To delay ShowAlert as long as you want, you could write a C# method and register it with Lua. For example:

Code: Select all

public void ShowAlertDelayed(string message, double delay)
{
    StartCoroutine(ShowAlertDelayedCoroutine(message, (float)delay);
}
IEnumerator ShowAlertDelayed(string message, float delay)
{
    yield return new WaitForSeconds(delay);
    ShowAlert(message);
}
To hide the dialogue UI but allow its coroutines to run on Portrait Panel (PC), use SetEnabled(Canvas) instead of SetDialoguePanel. Give the Dialogue Manager's canvas a unique name such as "DialogueCanvas". Then use a sequence like this:

Code: Select all

SetEnabled(Canvas, false, DialogueCanvas);
SpineAnimation(ListenIn,Player,0,false);
SetContinueMode(false);
Delay(2);
and:

Code: Select all

SpineAnimation(Idle,Player,0,true)@6;
SetEnabled(Canvas, true, DialogueCanvas)@7;
SetContinueMode(true)@9;
2gold
Posts: 19
Joined: Wed Aug 18, 2021 2:56 am

Re: Spine Animation does not play when it is in the On Trigger Enter state.

Post by 2gold »

I will try the method you told me.
Thank you always for your help!
Post Reply