Page 14 of 14

Re: About Dialogue Actor component

Posted: Thu Jun 24, 2021 10:37 am
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?

Re: About Dialogue Actor component

Posted: Thu Jun 24, 2021 10:51 am
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.

Re: About Dialogue Actor component

Posted: Sun Nov 07, 2021 7:36 am
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.