Forum rules - please read before posting.

Show hostpot icon without time limits

Hello,

Is it possible to show hotspot icons while player is holding certain button?
The options I found in settings allow only: Never, Always, Only when highlighting, Only when flashing.
And highlight/Flash have "time limits".

If this is not possible with built in features, is there a way to do this through code?

Thanks

Comments

  • I'm not sure what you mean about "time limits" - do you mean the Flash hold time (s) slider on the Highlight component?

    You can highlight all Hotspots in your scene by pressing the "FlashHotspots" button.  That will cause them to flash, but the Highlight can be turned on manually by invoking its HighlightOn method.

    You could therefore write a simple function to turn on all Highlights when a given button is pressed, e.g.:

    void Update ()
    {
        if (Input.GetButtonDown ("HighlightAll"))
        {
            SetHighlights (true);
        }
        else if (Input.GetButtonUp ("HighlightAll"))
        {
            SetHighlights (false);
        }
    }


    void SetHighlights (bool show)
    {
        Hotspot[] hotspots = FindObjectsOfType (typeof (Hotspot)) as Hotspot[];
        foreach (Hotspot hotspot in hotspots)
        {
            if (hotspot.IsOn () && hotspot.highlight && hotspot != KickStarter.playerInteraction.GetActiveHotspot ())
            {
                if (show)
                    hotspot.highlight.HighlightOn ();
                else
                    hotspot.highlight.HighlightOff ();
            }
        }
    }

  • Hello, Thank you!
    This works, but only when I have "Display hotspot icons" set to "Only when highlighting", which also result in hotspot icon being displayed when you hover mouse over hotspot. Is it possible to only show hotspot icon when this button is pressed?
  • You can prevent a Highlight turning on when a Hotspot is selected by commenting out line 718 of Hotspot.cs:

    highlight.HighlightOn ();

    I'll consider making this optional in a future update.
  • Hey, thanks!
    But this works a bit differently. This disables both the material highlight and the icon. and I'm trying to isolate only the icon. I suppose this should be done in Highlight script?
  • Sorry, I don't follow.

    The code change on Jan 5th prevents both the material highlight and icon from showing when selecting a Hotspot - so that you have full control over it with the script I posted Jan 3rd.

    You hadn't mentioned material highlights before (which can be optionally disabled in the Highlight component), so I assumed you weren't making use of them.

    Are you saying that you want the material highlight to show up as normal (i.e. when hovering the mouse over a Hotspot), and only have the icons themselves show up with a manual input?

    If so, it'll need a different approach - as icons and material highlights are normally synced together.
  • Ah sorry, yeah that is what I meant:
    "the material highlight to show up as normal (i.e. when hovering the
    mouse over a Hotspot), and only have the icons themselves show up with a
    manual input"
  • All right.  I'll look into adding a "Script Only" option for the "Display Hotspot icons" field, so that a dedicated function can control their visibility.
  • Thank you, that would be great!
  • Many thanks! Checking it out.
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.