I implemented a function that resets dialogue actors that I included in the DialgoueManager prefab.
As the DialogueManager prefab is included in the GameManager prefab which is persistent, the dialogue actors that are within the DialogueManager prefab are all persistent now.
I am changing the persistent dialogue actor's panel number manually via code or sequence command, so I need to reset them to their initial value every time I load any new scene.
In GameManager code,
Code: Select all
public DialogueActor[] persistentDialogueActors;
private SubtitlePanelNumber[] _persistentDialogueActorsPanelIDs;
void Awake()
{
// init persistent Dialogue Actor Panel IDs
_persistentDialogueActorsPanelIDs = new SubtitlePanelNumber[persistentDialogueActors.Length];
for (int i = 0; i < persistentDialogueActors.Length; i++)
{
_persistentDialogueActorsPanelIDs[i] =
persistentDialogueActors[i].standardDialogueUISettings.subtitlePanelNumber;
}
}
public void ResetPersistentDialougeActorPanelNumbers()
{
for (int i = 0; i < persistentDialogueActors.Length; i++)
{
persistentDialogueActors[i].standardDialogueUISettings.subtitlePanelNumber =
_persistentDialogueActorsPanelIDs[i];
}
}
Would the above be the ideal way?
Thank you,
J