Commit ae9a15094dba8528baccec025f191c611a3a4e28
1 parent
69eacbe1
Exists in
devel
Fix subtitles synchronizer starting
Showing
1 changed file
with
11 additions
and
1 deletions
Show diff stats
Assets/Scripts/PlayerManager/GenericPlayerManager.cs
| ... | ... | @@ -486,7 +486,13 @@ public abstract class GenericPlayerManager : MonoBehaviour { |
| 486 | 486 | string lastAnimationSubtitle = ""; |
| 487 | 487 | bool spelled = false; |
| 488 | 488 | |
| 489 | - StartCoroutine(subtitlesSynchronizer); | |
| 489 | + Debug.Log("GPM.LAP(" + gloss + "): Starting subtitlesSynchronizer"); | |
| 490 | + | |
| 491 | + if (this.subtitlesSynchronizer == null) | |
| 492 | + this.subtitlesSynchronizer = SubtitlesSynchronizer(); | |
| 493 | + | |
| 494 | + StartCoroutine(this.subtitlesSynchronizer); | |
| 495 | + yield return null; | |
| 490 | 496 | |
| 491 | 497 | string[] stringPos = gloss.Split(' '); |
| 492 | 498 | |
| ... | ... | @@ -595,6 +601,8 @@ public abstract class GenericPlayerManager : MonoBehaviour { |
| 595 | 601 | if (toPlayQueue.Count > 4 || wordsCount == stringPos.Length) |
| 596 | 602 | while (toPlayQueue.Count > 0) |
| 597 | 603 | toPlayQueue.Dequeue().play(this); |
| 604 | + | |
| 605 | + yield return null; | |
| 598 | 606 | } |
| 599 | 607 | |
| 600 | 608 | // Default |
| ... | ... | @@ -694,6 +702,8 @@ public abstract class GenericPlayerManager : MonoBehaviour { |
| 694 | 702 | |
| 695 | 703 | resetStates(); |
| 696 | 704 | this.randomAnimations.unlockFor("GPM.SubtitlesSynchronizer"); |
| 705 | + | |
| 706 | + this.subtitlesSynchronizer = null; | |
| 697 | 707 | } |
| 698 | 708 | |
| 699 | 709 | public void resetStates() | ... | ... |