Page 2 of 2

Re: Portrait animator skipping first frame

Posted: Fri Nov 05, 2021 12:45 pm
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.

Re: Portrait animator skipping first frame

Posted: Fri Nov 05, 2021 2:12 pm
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.

Re: Portrait animator skipping first frame

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

Re: Portrait animator skipping first frame

Posted: Mon Nov 08, 2021 6:19 pm
by VoodooDetective
Sorry I missed this! That worked a treat! With that patch, the issue is gone.

Re: Portrait animator skipping first frame

Posted: Mon Nov 08, 2021 7:44 pm
by Tony Li
Great! Thanks for confirming. The change is already committed to the repo for the next release.