I'm trying to use the characters' speech color to paint the background of the text panel, instead of the text itself.
I tried putting this in a public method
GameObject.Find("SubtitlesPanel").GetComponent<RawImage>().color = AC.KickStarter.dialog.GetSpeakingCharacter().speechColor;
and then calling the method via an ActionList whenever the subtitles panel was turned on.
It seemed straightforward enough, but sadly, it didn't work as expected. The background color remained unchanged while the text was displaying. BUT the correct color flashed for a moment just before the subtitle was gone.
I have crafted a few semi-working solutions, but none of them feels right, so I thought I'd ask for your help to figure this out.
Thanks in advance
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
At what moment are you changing the colour? Once the Speech Action has completed?
A better way to do this would be to hook into the OnStartSpeech event, which is triggered every time a speech line begins - and includes a parameter to get the speaking character:
For more on custom events, see this tutorial.
At first glance this seems to be working, with the following two remarks (for anyone wanting to do the same) :
1. GameObject.Find returns null, so I had to use a public variable and assign the RawImage via the Inspector.
2. The "duplicate for each line" option must be disabled in the Menu Manager.
I'll put it to more tests later and let you know if I find anything unusual.
Thanks