Forum rules - please read before posting.

Show 'Use' icon AND the item icon in the cursor at the same time, if hovering over a hotspot

edited April 6 in Technical Q&A

Good morning,
What I'm trying to achieve is that when I select an inventory item (let's say, 'Worm'), I see that the cursor now appears as a Worm icon. That's good, but it doesn't confirm that I'm over a hotspot. I'd also like the cog/use icon to appear near my cursor if I hover over a hotspot in my scene (such as Barry the bird).

So with Worm selected from inventory, hovering over an empty area of my scene, I should just see just the worm icon at my cursor. If I hover over a hotspot I'd like to see the worm icon as well as a cog, so the user knows they are over the hotspot. Is this possible? Many thanks in advance for any help. Mike.

Comments

  • Welcome to the community, @MikeH.

    The Hotspot label can be used to help inform the user if a Hotspot is selected, but to specifically show an icon: there's a couple of ways to do it.

    The "quick-and-dirty" method is to create a separate Menu that displays the icon when over Hotspots.

    To do this: create a Menu with a Position of Follow Cursor, and Appear type of On Hotspot, styling with e.g. a Graphic element to display your intended icon.

    To have this only show while an Inventory item is selected, check Start game locked off? to prevent it from showing by default, and then use the Events Editor (available in the top toolbar) to create Inventory: Select and Inventory: Deselect events that unlock and lock the Menu respectively.

    The alternative is to use Unity UI as the basis for your Cursor, which allows you full control over its display.

    To do this, set your Cursor Manager's Cursor rendering to Unity UI, and then alter the provided default CursorUI prefab. The additional icon can be added as an Image component attached to a child object. To have it appear when both an Inventory and Hotspot are selected, you can attach the following script (DynamicHotspotIcon.cs):

    using UnityEngine;
    using UnityEngine.UI;
    using AC;
    
    public class DynamicHotspotIcon : MonoBehaviour
    {
        void Update ()
        {
            bool show = KickStarter.runtimeInventory.SelectedItem != null && KickStarter.playerInteraction.GetActiveHotspot () != null;
            GetComponent<Image> ().enabled = show;
        }
    }
    
  • Thank you Chris - this looks promising but I am not able to locate the Events Editor. I checked in the main menu under Adventure Creator > Editors, but all I see there are 'Active Inputs Editor', 'ActionList editor', 'Character Wizard', 'Soundtrack' and 'Game Editor', am I looking in the wrong place?

  • What's your AC version? The Events Editor was introduced in v1.78.

  • Ah that's it I was on an older version. OK perfect all sorted, I've got my cursor how I want it now thank you Chris.

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.