Manipulate object outline based on dialogue status
Posted: Sun May 25, 2025 7:25 am
Hi there,
Hopefully you can help me. I have a stystem currently where on a button pressvarious objects that can be interacted with are highlighted in an outline. I would like to make it so that when there is a fresh dialogue interaction to be had the outline is one colour, and when it has been seen by the player it is another.
I have what I think is a good structure for this, but am now trying to think of the best way to get the dialogue status for each object. Would the best way to simply create a new bool variable for each individual object and get that?
I have attached two controllers I have set up for this. I also haev a script controlling the outline.
Thank you.
Hopefully you can help me. I have a stystem currently where on a button pressvarious objects that can be interacted with are highlighted in an outline. I would like to make it so that when there is a fresh dialogue interaction to be had the outline is one colour, and when it has been seen by the player it is another.
I have what I think is a good structure for this, but am now trying to think of the best way to get the dialogue status for each object. Would the best way to simply create a new bool variable for each individual object and get that?
I have attached two controllers I have set up for this. I also haev a script controlling the outline.
Thank you.
Code: Select all
public class EnableOutline : MonoBehaviour
{
Outline outline;
public DialogueOutlineStatus status;
public Color newColour = Color.yellow;
public Color talkedColour = Color.gray;
public bool showOutline;
private void Awake()
{
if (!TryGetComponent(out outline)) return;
outline.enabled = false;
}
void Update()
{
if (!outline) return;
outline.enabled = Input.GetKey(KeyCode.Tab);
}
private void OnEnable()
{
if (!TryGetComponent(out outline)) return;
outline.OutlineColor = status.hasTalkedTo ? talkedColour : newColour;
}
}
Code: Select all
public class DialogueOutlineStatus : MonoBehaviour
{
public bool hasTalkedTo = false;
}