Page 1 of 1
Change background of dialogue option depending on state
Posted: Tue Dec 27, 2022 2:12 pm
by Adeoon
Hi, so my dialogue options once read should have grey background as a highlight that player already ask about tha for example. I want to do it as simple as possible. One way to do that is make variable for each dialogue option, but that is very not optimal I would say. Do dialogue system supports that feature?
Re: Change background of dialogue option depending on state
Posted: Tue Dec 27, 2022 3:04 pm
by Tony Li
Without any scripting, you can set the format of the text (color, italics, bold, etc.), but not the background. To do this:
1. Tick the Dialogue Manager GameObject's Other Settings > Include SimStatus.
2. Set the Dialogue Manager's Input Settings > [em#] Tag For Old Responses.
3. In the Dialogue Editor window's Database tab, set the appearance of the selected [em#] tag under the Emphasis Settings foldout.
If you want to change the background, you'll need to do a little scripting. You can make a subclass of StandardUIMenuPanel. (See
this post for how to replace your StandardUIMenuPanel component.) Override SetResponseButton(). Something like:
Code: Select all
public class MyMenuPanel : StandardUIMenuPanel
{
protected override void SetResponseButton(StandardUIResponseButton button, Response response, Transform target, int buttonNumber)
{
base.SetResponseButton(button, response, target, buttonNumber);
var alreadyAsked = DialogueLua.GetSimStatus(response.destinationEntry) == DialogueLua.WasDisplayed;
var backgroundImage = button.GetComponent<Image>();
backgroundImage.color = alreadyAsked ? Color.gray : Color.clear;
}
}