Changing SubtitlePanel background color according to speaking Actor
Posted: Thu Apr 29, 2021 5:47 am
[Unity 2019.4.25f1 - DS v2.2.16]
Hi Tony,
In the game I'm working on, I'm trying to find a way to override the Image component's color of the StandardUISubtitlePanel, much like you would override the color of the Subtitle text by adding a DialogueActor component.
I am not sure how should I proceed, though. I've been looking into the DialogueActor script to get some inspiration, but I'm getting a bit lost in the structure.
For example, I noticed that StandardUISubtitlePanelControls uses DialogueActor.AdjustSubtitleColor() to override Subtitle text color. Therefore, I assume that I need to come up with an equivalent method that does that for the Image component, as well.
Should I create derived classes for both the DialogueActor and StandardUISubtitlePanelControls? I'm not sure this is the right way to proceed (probably doesn't mean anything but I already have a derived class from StandardDialogueUI that I use for my Dialogue UIs).
One thing I have tried to do is:
Any advice or pointers, or am I overcomplicating this?
As always, thanks a million in advance.
EDIT: Of course I also assume I could use separate custom UIPanel prefabs for each Actor, but I wondered if I could avoid doing that!
Hi Tony,
In the game I'm working on, I'm trying to find a way to override the Image component's color of the StandardUISubtitlePanel, much like you would override the color of the Subtitle text by adding a DialogueActor component.
I am not sure how should I proceed, though. I've been looking into the DialogueActor script to get some inspiration, but I'm getting a bit lost in the structure.
For example, I noticed that StandardUISubtitlePanelControls uses DialogueActor.AdjustSubtitleColor() to override Subtitle text color. Therefore, I assume that I need to come up with an equivalent method that does that for the Image component, as well.
Should I create derived classes for both the DialogueActor and StandardUISubtitlePanelControls? I'm not sure this is the right way to proceed (probably doesn't mean anything but I already have a derived class from StandardDialogueUI that I use for my Dialogue UIs).
One thing I have tried to do is:
- hold the Actor\Background color combination data in a separate GameObject to refer to when needed;
- use the DialogueSystemEventBroadcaster to send OnConversationLine \ OnPrepareConversationLine to a custom component I added to the Subtitle Panels
Any advice or pointers, or am I overcomplicating this?
As always, thanks a million in advance.
EDIT: Of course I also assume I could use separate custom UIPanel prefabs for each Actor, but I wondered if I could avoid doing that!