Portrait animator skipping first frame

Announcements, support questions, and discussion for the Dialogue System.
VoodooDetective
Posts: 222
Joined: Wed Jan 22, 2020 10:48 pm

Re: Portrait animator skipping first frame

Post by VoodooDetective »

Here's what I ended up reverting:

Code: Select all

diff --git a/Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs b/Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs
index 945ea8510..9a53a64dd 100644
--- a/Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs	
+++ b/Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Sequencer/Sequencer.cs	
@@ -569,18 +569,18 @@ namespace PixelCrushers.DialogueSystem
                             break;
                     }
                 }
-            }
-        }
-
-        public void LateUpdate()
-        {
-            if (m_isPlaying)
-            {
-                foreach (string message in queuedMessages)
-                {
-                    Sequencer.Message(message);
-                }
-                queuedMessages.Clear();
+                //     }
+                // }
+
+                // public void LateUpdate()
+                // {
+                //     if (m_isPlaying)
+                //     {
+                //         foreach (string message in queuedMessages)
+                //         {
+                //             Sequencer.Message(message);
+                //         }
+                //         queuedMessages.Clear();
                 if ((m_queuedCommands.Count == 0) && (m_activeCommands.Count == 0) && m_delayTimeLeft <= 0)
                 {
                     FinishSequence();
@@ -972,14 +972,14 @@ namespace PixelCrushers.DialogueSystem
                 bool ignore = (e is InvalidOperationException || e is ArgumentOutOfRangeException);
                 if (!ignore) throw;
             }
-            finally
-            {
-                if (receivedMessage != null) receivedMessage(message);
-            }
+            // finally
+            // {
+            //     if (receivedMessage != null) receivedMessage(message);
+            // }
         }
 
-        // Processed in LateUpdate():
-        private List<string> queuedMessages = new List<string>();
+        // // Processed in LateUpdate():
+        // private List<string> queuedMessages = new List<string>();
 
         private void CheckActiveCommands()
         {
@@ -992,11 +992,12 @@ namespace PixelCrushers.DialogueSystem
                     var command = m_activeCommands[i];
                     if (command != null && !command.isPlaying)
                     {
-                        if (!string.IsNullOrEmpty(command.endMessage))
-                        {
-                            //--- Now queued for LateUpdate: Sequencer.Message(command.endMessage);
-                            queuedMessages.Add(command.endMessage);
-                        }
+                        if (!string.IsNullOrEmpty(command.endMessage)) Sequencer.Message(command.endMessage);
+                        // if (!string.IsNullOrEmpty(command.endMessage))
+                        // {
+                        //     //--- Now queued for LateUpdate: Sequencer.Message(command.endMessage);
+                        //     queuedMessages.Add(command.endMessage);
+                        // }
                         m_commandsToDelete.Add(command);
                     }
                 }

After I reverted, the single frame issue went away again. LateUpdate happens after animation so I think it makes sense that this would be an issue.
User avatar
Tony Li
Posts: 22158
Joined: Thu Jul 18, 2013 1:27 pm

Re: Portrait animator skipping first frame

Post by Tony Li »

I'll trace through this again. It's sounding like I'll end up making your reverted version the default, and adding a compiler condition option to send messages in LateUpdate() for those who need it.
User avatar
Tony Li
Posts: 22158
Joined: Thu Jul 18, 2013 1:27 pm

Re: Portrait animator skipping first frame

Post by Tony Li »

Hi,

If you get a chance, would you please confirm that this Sequencer.cs patch also works in your project? It moves the message-sending code back to Update() by default.

DS_SequencerDevPatch_2021-11-07.unitypackage
VoodooDetective
Posts: 222
Joined: Wed Jan 22, 2020 10:48 pm

Re: Portrait animator skipping first frame

Post by VoodooDetective »

Sorry I missed this! That worked a treat! With that patch, the issue is gone.
User avatar
Tony Li
Posts: 22158
Joined: Thu Jul 18, 2013 1:27 pm

Re: Portrait animator skipping first frame

Post by Tony Li »

Great! Thanks for confirming. The change is already committed to the repo for the next release.
Post Reply