About Dialogue Actor component

Announcements, support questions, and discussion for the Dialogue System.
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: About Dialogue Actor component

Post by Tony Li »

Ah, that's right. I think that info can be held in each conversation's ConversationModel, so I'll look into it.
CHOPJZL
Posts: 97
Joined: Wed Sep 02, 2020 10:05 pm

Re: About Dialogue Actor component

Post by CHOPJZL »

Hi,
I saw the sequencer has ConversationRecord now. Thanks for the update.

Recently I was writing some custom sequencecommands, when I use end message, the next command begins a tiny period(maybe just 1 frame) after the former command stops. I think maybe it is caused by the process of sending and receiving messages.
Because my custom command sets and resets some custom value at start and end. This tiny period will cause a flicker when several commands are running as a sequence. Could you make it so that when using end message, the next command start at the same frame as the former command stops?

Another request:
Could you add an unique int id in the ConversationRecord? Maybe add it when creating the record. It will be quite handy when dealing with custom conversation variables
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: About Dialogue Actor component

Post by Tony Li »

CHOPJZL wrote: Wed Jun 23, 2021 1:08 amRecently I was writing some custom sequencecommands, when I use end message, the next command begins a tiny period(maybe just 1 frame) after the former command stops. I think maybe it is caused by the process of sending and receiving messages.
Because my custom command sets and resets some custom value at start and end. This tiny period will cause a flicker when several commands are running as a sequence. Could you make it so that when using end message, the next command start at the same frame as the former command stops?
Can you post an example sequence here?
CHOPJZL wrote: Wed Jun 23, 2021 1:08 amCould you add an unique int id in the ConversationRecord? Maybe add it when creating the record. It will be quite handy when dealing with custom conversation variables
Good idea. I'll add that.
CHOPJZL
Posts: 97
Joined: Wed Sep 02, 2020 10:05 pm

Re: About Dialogue Actor component

Post by CHOPJZL »

Can you post an example sequence here?
Actually it is a DS version of Utage command. Utage is an AVG engine on the asset store. So it is not easy to post here. Basically at the start of the commandAAA, it changes a sprite's material and fade the sprite out but keep its alpha. At the end it changes the material back, so the sprite become visiable again as the alpha is 1.0, which is not what I wanted. So I used another commandBBB that immediately set the alpha to 0.

I use end message for the connection of these 2 commands. but there is a flicker on the sprite. I tried the original 2 commands in Utage and it doesn't flick. So I assume the source is the mechanism of sequencer

If it is needed, I will try to write a custom command that just sets and resets some integer, I think their mechanism is same
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: About Dialogue Actor component

Post by Tony Li »

I'm just interested in the syntax of the sequence. The actual commands don't matter. The timing should happen on the same frame already.
CHOPJZL
Posts: 97
Joined: Wed Sep 02, 2020 10:05 pm

Re: About Dialogue Actor component

Post by CHOPJZL »

I saw the CheckActiveCommands() method called in the Update() of sequencer, is there any chance the end message is sent 1 frame after stop() called?
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: About Dialogue Actor component

Post by Tony Li »

Yes, it's possible due to the way Unity's script execution order works. Here are two ways you may be able to resolve it:

1. In Edit > Project Settings > Script Execution Order, set your sequencer command's execution order to be < 0.

2. Or don't finish the sequencer command's processing when you call Stop(). Instead, finish the processing in its OnDestroy() method.
CHOPJZL
Posts: 97
Joined: Wed Sep 02, 2020 10:05 pm

Re: About Dialogue Actor component

Post by CHOPJZL »

The first way seems not working, but OnDestroy() approach works :D
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: About Dialogue Actor component

Post by Tony Li »

Great! The built-in sequencer commands use OnDestroy(), too, for this reason.
CHOPJZL
Posts: 97
Joined: Wed Sep 02, 2020 10:05 pm

Re: About Dialogue Actor component

Post by CHOPJZL »

But I noticed another problem.

CommandAAA and commandBBB set and reset the same propertyXX, When commandAAA stops, it triggers commandBBB to start and set propertyXX, then commandAAA's OnDestroy() runs and reset propertyXX far before commandBBB finish.

I switched back the finish processing back, and made a change in CheckActiveCommands() method. I didn't expect it to work but the flicker is gone.

Code: Select all

                        //if (!string.IsNullOrEmpty(command.endMessage)) Sequencer.Message(command.endMessage);
                        m_commandsToDelete.Add(command);
                        //--- if (0 <= i && i < m_activeCommands.Count) m_activeCommands.RemoveAt(i);
                        Destroy(command);
                        //send message after Destroy
                        if (!string.IsNullOrEmpty(command.endMessage)) Sequencer.Message(command.endMessage);
----------------------------
Forget it, the flicker still there after I run another time.
Post Reply