I'm currently changing character portraits in the sequencer using SetPortrait and pic=index#. However, I was wondering if there was a way/a way that could be added to use a name/label in addition to the index number. It's a bit difficult to remember what portrait the index numbers refer to sometimes, and I feel like it would be easier if I could use labels for each portrait such as "happy" for index 1 or "angry" for index 2 in addition to the index numbers. I'm thinking of something like an optional portrait labels field next to the portrait list in the actor editing window that each corresponds to an index number.
I know something like this can be achieved through the Resources folder, however, I've heard quite a few negative things that are involved with it, so I'd prefer not to use it. Plus, it'd be more convenient to be able to use the shorter label from the actor rather than the file path.
Sorry if this was answered elsewhere; I did my best to look around before asking.
Set portrait using name/label instead of index number
Re: Set portrait using name/label instead of index number
The reason why Resources is bad is because the game loads all content in Resources folders when the game starts, even if you don't need to use that content right away, and it keeps it in memory.
However, if you're going to use assets such as character portraits throughout the game, it's generally fine to load them when the game starts. It's certainly simpler than setting up asset bundles or using addressables. (However, the Dialogue System does support asset bundles and addressables if that's what you want to use.)
In addition, if you assign portraits to the dialogue database, they'll be loaded as soon as the dialogue database is loaded anyway. So it's really just a matter of preference.
Here's a trick you can use to specify labels instead of indices:
1. Define Number variables in your dialogue database, such as neutral=1, happy=2, excited=3, etc.
2. Add portraits so they correspond to those numbers (e.g., happy portrait is pic 2).
3. Use the [var] tag in your dialogue text:
However, if you're going to use assets such as character portraits throughout the game, it's generally fine to load them when the game starts. It's certainly simpler than setting up asset bundles or using addressables. (However, the Dialogue System does support asset bundles and addressables if that's what you want to use.)
In addition, if you assign portraits to the dialogue database, they'll be loaded as soon as the dialogue database is loaded anyway. So it's really just a matter of preference.
Here's a trick you can use to specify labels instead of indices:
1. Define Number variables in your dialogue database, such as neutral=1, happy=2, excited=3, etc.
2. Add portraits so they correspond to those numbers (e.g., happy portrait is pic 2).
3. Use the [var] tag in your dialogue text:
- Dialogue Text: "I'm happy! [pic=[var=happy]]"
Re: Set portrait using name/label instead of index number
Thanks for the reply! I started looking into addressables, and it seems like it might be what I'm looking for. However, I'm unsure of how to get the dialogue system to work with them. I checked the 2.2.7 update post which mentioned a checkbox in the welcome window to activate them, however, I am unable to find it. I'm also still using the evaluation version if that affects anything.
Re: Set portrait using name/label instead of index number
Hi,
Since it's a compiler option and the evaluation version comes precompiled, you can't enable addressables support with the evaluation version.
Since it's a compiler option and the evaluation version comes precompiled, you can't enable addressables support with the evaluation version.