Forum rules - please read before posting.

Possible bug for manual hotspot assignment

edited March 2021 in Technical Q&A

Hey Chris,

I've run into what might be a bug with controlling Hotspots through a custom script. Is the DeselectHotspot() method supposed to clear the current hotspot and disable the Hotspot menu?

The game I'm working on is a top-down space shooter which uses button inputs for a targeting system. The custom targeting system iterates through an array of NPCs, planets and other objects and will manually swap the active hotspot using:

AC.KickStarter.playerInteraction.SetActiveHotspot(currentTargetObject.GetComponent< Hotspot>());

(currentTargetObject is the gameObject of the object selected by the targeting system).

It works just fine, and I can then toggle on the interaction menu using a button press to interact with the targeted object.

However, I've found that using AC.Kickstarter.playerInteraction.DeselectHotspot(); doesn't deselect the hotspot or disable the Hotspot UI.

Instead, I have to use SetActiveHotspot(null); to clear the current hotspot, which then disables the Hotspot menu.

It's not a huge deal, but I wanted to make sure I wasn't missing anything.

Cheers

Comments

  • edited March 2021

    The DeselectHotspot function is called regularly by PlayerInteraction as part of its automatic behaviour. If the Hotspot is manually-set through custom script, though, it avoids clearing the value - as it should continue to rely on the custom script to determine when a Hotspot is set/unset.

    One thing to keep in mind, though, is that you don't strictly have to rely on the PlayerInteraction's internal Hotspot value - through script, you should be able to bypass it and enable an Interaction menu for any given Hotspot, e.g.:

    PlayerMenus.GetMenuWithName ("Interaction").SetHotspot (myHotspot, null);
    PlayerMenus.GetMenuWithName ("Interaction").TurnOn ();
    

    If things are already working as they are, though, probably best to leave as-is.

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.