About Dialogue Actor component

Announcements, support questions, and discussion for the Dialogue System.
CHOPJZL
Posts: 97
Joined: Wed Sep 02, 2020 10:05 pm

Re: About Dialogue Actor component

Post by CHOPJZL »

Then I tried to move CheckActiveCommands() and the code after it to LateUpdate() of sequencer. This time it seems working after I tested several times.

Code: Select all

        public void Update()
        {
            if (m_isPlaying)
            {
                CheckQueuedCommands();
            }
        }

        private void LateUpdate()
        {
            if (m_isPlaying)
            {
                CheckActiveCommands();
                if (m_delayTimeLeft > 0)
                {
                    switch (DialogueTime.mode)
                    {
                        case DialogueTime.TimeMode.Realtime:
                            m_delayTimeLeft -= Time.unscaledDeltaTime;
                            break;
                        case DialogueTime.TimeMode.Gameplay:
                            m_delayTimeLeft -= Time.deltaTime;
                            break;
                    }                    
                }
                if ((m_queuedCommands.Count == 0) && (m_activeCommands.Count == 0) && m_delayTimeLeft <= 0)
                {
                    FinishSequence();
                }
            }
        }
How do you think of this modification? Is it truely solves the problem, is it safe for other commands?
User avatar
Tony Li
Posts: 21925
Joined: Thu Jul 18, 2013 1:27 pm

Re: About Dialogue Actor component

Post by Tony Li »

That was actually on my list to evaluate for 2.2.19. :-) I added it after this conversation. I think it will be safe, but I need to go through code carefully to make sure.
User avatar
Tony Li
Posts: 21925
Joined: Thu Jul 18, 2013 1:27 pm

Re: About Dialogue Actor component

Post by Tony Li »

There is a change coming in version 2.2.23. To continue to send messages in LateUpdate, you'll need to add the scripting define symbol LATEUPDATE_MESSAGES.
Post Reply