Forum rules - please read before posting.

All Hotspots shows an icon that appear at the beginning of the scene or at specified time

Dear,

Currently, I'm using 'Display Hotspot icons' set to Always, 'Hotspot icon type' - Texture
I want to achieve the following thing:

When the scene starts, all the hotspots icons appear for few seconds and after that disappear. Also, if it's possible to put a global variable that offers the player to set-up the time when the hotspots icons appear again for a few seconds.
It's like a little help/clue for the active objects from the scene, but I don't want to bother the player with too many icons on the display.

AC 1.70
Unity 2018.4.17f1

Comments

  • I figure out how to approach my own request by using invokerepeating and/or coroutine methods.
    Now I have a problem with selecting specific hotspots. I don't want all of them. How can I select specific hotspots?

    To set icon visibility for all hotspots I use the following code:

    hotspots = FindObjectsOfType(typeof(Hotspot)) as Hotspot[];
            foreach (Hotspot hotspot in hotspots)
            {
                hotspot.SetIconVisibility(false, speed);
            }
    
  • You can assign specific Hotspots with a special tag e.g. "FlashMe". Your script can then check for this tag, i.e.:

    if (hotspot.tag == "FlashMe")
        hotspot.SetIconVisibility(false, speed);
    

    Be aware that you can also have Hotspots flash up momentarily with the FlashHotspots input, regardless of the Display Hotspot icons field value. This input can be simulated through script:

    AC.KickStarter.playerInput.SimulateInputButton ("FlashHotspots");
    
  • Thank you for the tip, Chris.
    One more question regarding the search by tag: what about memory costs? It's faster? for example if I have more than 100 hotspots will be very slow?

  • You'd certainly want to cache your hotspots rather than gather them every frame.

    Actually, the StateHandler already does this - you can rely on this instead of your own variable:

    int numHotspots = KickStarter.stateHandler.Hotspots.Count;
    for (int i=0; i<numHotspots; i++)
    {
        KickStarter.stateHandler.Hotspots[i].SetIconVisibility(false, speed);
    }
    
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.