Live Info Bar - Detecting a change in a GUI

Hello,

I am trying to produce a ‘Live Information’ bar that appears whenever there is a change in certain information. Different information can be provided wherever you are in the game, based where you are in the world. I have game objects which have certain information attached like the name of the zone, a bit of blurb, sights to see, etc.

As you enter into a new zone, I’d like a bar at the bottom of the screen to pop/fade up showing this information. Now this can be either hidden/closed or automatically fade down after say 5 seconds.

Ie.
(walk into zone OnTriggerEnter) FADEUP "You have now entered Zone 1. This is where you will be able to explore something."WaitforSeconds(5); FADEDOWN
(Walk up to a hotspot) FADEUP “Welcome to the information centre. Press RETURN to enter.” WaitforSeconds(5); FADEDOWN
When leaving (OnTriggerExit)FADEUP “You have just left Zone 1” WaitforSeconds(5); FADEDOWN

So far I have a G.O. with the GUI placeholder, the ‘hotspots’ with string variables with the information to provide and a character controller which will detect the Triggers.

What is the easiest way to detect when text is changed within the world, then fade up? I know GUI.Changed is fairly irrelavent to this situation.

So basically when the label is updated you want the GUI object to show then fade out? So you need to know when it’s been changed (the label)?

What I would do is on your SetInfoLabel() (or whatever) function that is being called by other objects that trigger it, have it also set a flag that it’s been changed.

void SetInformationLabel(string text)
{
    mLabelString = text;
    mLabelUpdated = true;
}
void OnGUI()
{
    if(mLabelUpdated)
    {
        mLabelUpdated = false;
        StartCoroutine(FadeInThenOutLabel());

You could also do it with timers where mLabelUpdated keeps the time stamp of when it was updated and then do events based off that, but I think coroutines make that a bit cleaner.

Hope that helps!