Hi,
If you're using SetPortrait(FirstNPC, pic=1), this means it's using a portrait image from the actor's portrait list in the dialogue database. When the Dialogue Manager starts, it loads the dialogue database into memory. Since the dialogue database references the portrait images, they should also be loaded into memory at start. There shouldn't be any async loading.
This may not be relevant to your goals, but it
is possible to configure the portraits so they're not all loaded when the Dialogue Manager starts. To do this, you'd put the portraits in a Resources folder, asset bundle, or make them addressable assets. Then use SetPortrait(FirstNPC,
filename) to load and use the portrait image. (Note: If you use addressables, they could load asynchronously, meaning they might appear after a delay.)
To address your issue, is it possible that something is setting the actors to use another portrait image, not pic=1?
Alternatively, if you want to make sure the portraits are loaded, you could check them when the Dialogue Manager starts. For example, put a script similar to this on the Dialogue Manager:
Code: Select all
using System.Collections;
using UnityEngine;
using PixelCrushers.DialogueSystem;
public class CheckPortraits : MonoBehaviour
{
IEnumerator Start()
{
while (!DialogueManager.instance.isInitialized) yield return null;
foreach (var actor in DialogueManager.masterDatabase.actors)
{
var actorName = actor.Name;
if (actor.spritePortrait != null)
{
Debug.Log($"{actorName} pic 1 is {actor.spritePortrait.name}");
}
for (int i = 0; i < actor.spritePortraits.Count; i++)
{
if (actor.spritePortraits[i] != null)
{
Debug.Log($"{actorName} pic {i+2} is {actor.spritePortraits[i].name}");
}
}
}
}
}