Forum rules - please read before posting.

Hotspot click event

Hi there,

I was looking through the scripting guide to find something similar to an OnHotspotClick event in EventManager or other places but couldn't find anything. What I want is to get notified once a hotspot has been clicked (much like the OnHotspotSelect event that notifies me once a hotspot has been hovered on). Is it missing?

Please note that I'm well aware Unity offers numerous very easy ways to do exactly that but I was looking for a way to do it within AC.

Thanks.

Comments

  • I saw that event but unfortunately it is not what I need. In Interaction method: "Choose Hotspot Then Interaction" and See Interactions with: "Click On Hotspot", you first click the hotspot to see the interaction menu. This is the click I'm after - a simple click on the hotspot. It's before I click any interaction in the interaction menu so OnHotspotInteract is not good for what I need.
  • If this is to occur when the Interaction Menu opens, you can run an ActionList that runs when the Menu is turned on.  I will look to add events for this as well.
  • Unfortunately not. The handler for the said click event is to decide whether to display the Interaction Menu or not so I can't use this either.

    Unity does offer ways to do this but for the sake of completeness, I do believe EventManager should offer such event so thanks for looking into it.

  • I don't think an event there would do what you want, in that case.  Triggered events are supplemental to whatever it is AC does - so if an event is triggered upon opening an Interaction menu, that menu is always going to be opened.

    That said, if the Menu you're turning on is fading in, you can cancel it by placing a Menu: Change state Action inside its ActionList when turn on asset and opting to turn it off instantly.
  • My Interaction menu's Appear type is set to Manual so it doesn't open automatically. I would like to decide in the handler for the Click event whether to open the Interaction menu manually or not depending on some logic.

    By the way, I did spot some inconsistency of sorts. My Interaction menu is set to Appear type: Manual and I have no other menu set to Appear type: On Interaction so if I don't do anything on that Hotspot click, no menu is displayed when I click the Hotspot. But because my "See Interactions with" is set to "Click On Hotspot" (there is no "None" option, I'm afraid), then KickStarter.playerMenus.IsInteractionMenuOn() already returns true when I click the Hotspot even though no Interaction menu is displayed.
  • edited August 2016
    Just as there is no "None" option, AC also expects Interaction Menus to make use of the On Interaction appear type.  This is a special-case type that causes the Menu to have any Interaction elements within it to be matched with the clicked Hotspot / Inventory item (basically, only show the icons that apply).

    But this is a good point.  Since the Menu function that does this, MatchInteractions, is public, it ought to be possible to write a script that does this manually and then turns the Menu in question on.  Perhaps a new "See interactions with" mode of "Rely on custom event" would be appropriate here.  Or perhaps something else - I'll have a think about it.
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.