Forum rules - please read before posting.

Hotspot reveal?

Sorry to bother everyone,

Does anyone know of a tutorial that I can follow for creating a Hotspot reveal button?
I.E. The user clicks a button in game and hotspots are revealed for a small amount of time

Regards
Martyn

Comments

  • I found this code. Apologies but my skills are weak in this regard.
    Can I just attach this to a menu button? and how would i do this

    `using UnityEngine;

    using System.Collections;

    using AC;

    public class ShowHotspotIcons : MonoBehaviour

    {

    public float speed = 5f;
    
    Hotspot[] hotspots;
    
    
    
    void Start ()
    
    {
    
        hotspots = FindObjectsOfType (typeof (Hotspot)) as Hotspot[];
    
    }
    
    
    
    void Update ()
    
    {
    
        if (!KickStarter.stateHandler.IsInGameplay () || Input.GetButtonUp ("HighlightAll"))
    
        {
    
            SetHighlights (false);
    
        }
    
        else if (Input.GetButtonDown ("HighlightAll"))
    
        {
    
            SetHighlights (true);
    
        }
    
    }
    
    
    
    void SetHighlights (bool show)
    
    {
    
        foreach (Hotspot hotspot in hotspots)
    
        {
    
            if (hotspot.IsOn () && hotspot.highlight)
    
            {
    
                hotspot.SetIconVisibility (show, speed);
    
            }
    
            else
    
            {
    
                hotspot.SetIconVisibility (false, speed);
    
            }
    
        }
    
    }
    

    }`

  • The FlashHotspots input can be used to flash up all Hotspots for a brief time.

    To map this input to a menu button, set the Button's Click type to Simulate Input and map it to the FlashHotspots input.

  • OK thanks chris

  • I'm really sorry but I can't figure this out, I can't find the FlashHotspots input

  • FlashHotspots is an input that you can list in Unity's Input Manager. If you map it to a keyboard key, then pressing it will result in the Hotspots being flashed.

    You can define this in the Input Manager to test the effect, but it's not necessary to do so if you're simulating it via an AC Menu Button.

    To do so, you just need to set your button's Click type to Simulate Input. Then, in the fields that follow, set the Simulate property to Button, and Input axis to FlashHotspots.

  • edited April 2021

    Thanks,

    It doesn't seem to work. Do I need to change Hotspot settings?

    http://www.thenorthernbureau.co.uk/hotspots.png

  • The menu looks configured right. What is the effect of mapping this input to a key via the Input Manager and manually pressing it during gameplay?

    Are you looking to indicate Hotspots by them highlighting, or icons?

  • hhmm still doesn't work

    I'd like to indicate them with icons ideally

  • For them to display icons, you'll need to configure your Settings Manager's "Hotspot icon display" property.

    If nothing's occuring when pressing the key manually, however, it may be more to do with the way the Hotspots are set up. Even if only icons are to be shown, you still need to attach and assign a Highlight component to each Hotspot.

    Try running the 3D Demo game: those Hotspots are set up to react to the FlashHotspots input, and you can play with the Demo's "Hotspot icon display" property to see which behaviour you want for your own.

  • ok i'll take a look. Thanks Chris

  • Sorry Chris, still struggling with this

    current settings
    The icons appear if I set the Hotspots to 'always' appear
    http://www.thenorthernbureau.co.uk/hotspots2.png

  • I see no issue with the settings.

    Did you try pressing the FlashHotspots input manually in the 3D Demo game/scene?

  • Yes I ran the Evil Lair demo and tried the same settings.

    Unfortunately I couldn't get it to work

    AC 1.73.6
    Unity 2019.4.25f

    Is must be something I've missed. Any ideas?

  • edited May 2021

    The Evil Lair scene is part of a tutorial - it's not initially set up for Hotspots/Highlights. The 3D Demo is.

    Try a fresh import of AC into a new project, and create a new Input in Unity's Input Manager named "FlashHotspots", with a "Positive Button Name" of "space" (no quotes). Are you then able - in the 3D Demo - to highlight Hotspots during gameplay with a press of the space key?

  • Yes that works

  • Ok chris, i've got it working.

    So sorry for the incompetence lol

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.