Page 13 of 14
Re: About Dialogue Actor component
Posted: Thu Apr 15, 2021 8:54 am
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.
Re: About Dialogue Actor component
Posted: Wed Jun 23, 2021 1:08 am
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
Re: About Dialogue Actor component
Posted: Wed Jun 23, 2021 9:14 am
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.
Re: About Dialogue Actor component
Posted: Wed Jun 23, 2021 9:42 am
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
Re: About Dialogue Actor component
Posted: Wed Jun 23, 2021 10:35 am
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.
Re: About Dialogue Actor component
Posted: Wed Jun 23, 2021 10:43 am
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?
Re: About Dialogue Actor component
Posted: Wed Jun 23, 2021 11:19 am
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.
Re: About Dialogue Actor component
Posted: Wed Jun 23, 2021 10:38 pm
by CHOPJZL
The first way seems not working, but OnDestroy() approach works
Re: About Dialogue Actor component
Posted: Thu Jun 24, 2021 8:34 am
by Tony Li
Great! The built-in sequencer commands use OnDestroy(), too, for this reason.
Re: About Dialogue Actor component
Posted: Thu Jun 24, 2021 10:20 am
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.