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
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 ();
}
}
}
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?
highlight.HighlightOn ();
I'll consider making this optional in a future update.
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?
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.
"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"
http://adventure-creator.wikia.com/wiki/Showing_Hotspot_icons_with_a_keypress