Forum rules - please read before posting.

Hotspot Detection Method

Can't apologise enough if I've missed this in the manual, tutorials or forum however I've been searching all day and not found exactly what I'm looking for.

I'm using direct movement method (Keyboard or Controller) with no mouse visible during normal gameplay. I currently have Hotspots being detected via player vicinity however I'm looking for a specific behaviour and one that I do not actually believe is possible (without a lot of custom code obviously).

I want my player to move up to a hotspot (in this case it is a body in a crime scene) and when the players hotspot detector is within the body hotspot it highlights the body (I'm fine getting up to this point by the way) however this should then pop up with an icon above the body to signify that if the player presses the 'Use' input axis then they can activate the body hotspot which would then run the appropriate hotspot cutscene.

I haven't managed to get to this point yet however the trouble is that I would then like the hotspot interactions to change so my required solution becomes even more complicated. The cursor would become active upon entering the body hotspot and the player would be able to access hotspots on the body with the cursor to essentially gather evidence that is on the body. I'm fine with enabling/disabling the cursor however struggling with how to change the hotspot interaction method (from Player Vicinity detecting the hotspot and then the 'Use' Input axis activating it changing over to the mouse detecting a hotspot and the mouse also activating it).

Hopefully I've explained myself well enough and once again a huge thanks in advance for any support/help given.


  • So is the Hotspot detection method supposed to change through natural gameplay or is this a setting you want as an option?

    Changing fields in the Settings Manager at runtime requires a code snippet but it's very simple.  Any field's label can be right-clicked to copy the API reference to that field.  You can then change its value in a custom script or Action.
  • @ChrisIceBox

    Thanks again for the response, I really can't explain how useful this forum and your constant support is (it's as valuable as the fantastic asset itself)!

    Essentially changing at runtime via a custom script sounds like the way to go, I'm not expecting an official setting option to be implemented if I'm the only one who's raised it as a 'nice to have', could you therefore advise what that code snippet would be - I always like to pursue these options first to try and increase my programming knowledge!
  • Right-clicking the field's label and clicking Copy script variable with give you:


    This is an enum variable, so you can search hotspotDetection in the scripting guide to reveal the possible values:


    So to change it to mouse-over, you just want:

    AC.KickStarter.settingsManager.hotspotDetection = HotspotDetection.MouseOver;

    Bear in mind that this will change the values in the Settings Manager's asset file, meaning that value will be kept if you restart the game.  Therefore, you should set it back to whatever default value you want it to have when the game begins - by placing such an Action in your game's ActionList on start game, which you can define in the Settings Manager.
  • @ChrisIceBox

    Thanks, I'll check this out tonight. I may well be trying to make this too complicated and may well revert back to having one hotspot detection system throughout however I definitely wish to pursue the option to see if I can get it working efficiently and reliably! Thanks again.
  • @ChrisIceBox

    First time I've have had some spare time to get back in Unity since your advice so I've only just got to implementing it! Out of interest is it best to state Using AC; at the top of the script or change the HotspotDetection.MouseOver; to AC.HotspotDetection.MouseOver;? Is there any real difference or not?

    Thankfully I've managed to get things working pretty well, still a few more things to iron out. One of those is when the game starts and I'm in the 'Player Vicinity' settings the player walks up to HotspotA and activates it (as desired), this then changes to a new camera where HotspotB is and then runs through the various changes to get into the 'MouseOver' settings for hotspot detection. The problem I'm having is that HotspotB doesn't get enabled, it's current state is Off - I know why this happening after a bit of testing but no idea how to solve it. Essentially (correct me if I'm wrong) when the game starts and hotspot detection is PlayerVicinity it by default turns all hotspots to the off state and only then turns them on when the players hotspot detector enters them, the problem is that when I switch over to the new 'Mouse Over' settings and I try to access HotspotB I can't because it's state was still off before the switch (since the player's detector never actually triggered it before the change). I have tried simply using the Hotspot: Enable/Disable action however I believe the 'Current State:Off' is different to enable/disable because this doesn't seem to work. Any advice?

  • In what version of AC?

    Switching between the different Hotspot Detection methods shouldn't affect Hotspots - the Player Vicinity doesn't turn off Hotspots that are too far away, and a Hotspot should only be turned off if set to by the default setting of the Remember Hotspot component, or by using the Hotspot: Enable or disable Action.

    You should find that changing the field manually from within the Settings Manager allows you to seamlessly switch between the two modes - try it in the 3D Demo game with the 3D Demo Managers assigned.

    A Hotspot is determined by whether or not it is off by the layer it is placed on: Default for On, Ignore Raycast for Off.  Please post some images showing the Hotspot's state before and after this occurs.
  • @ChrisIceBox

    I quickly tested my scene again and looked at the layer of the hotspot, they were being put into a DistantHotspot layer which I'm guessing is the reason they were turned off and so when i switched modes the hotspot would stay in this layer because from what I understand the only way to change this in game would be for the players detector to trigger it?

    I've therefore looked in the settings manager and have disabled the DistantHotspot layer option and the hotspot is now in an on state when I switch. Still struggling to get the second hotspot method working exactly how I want however I'll be playing with it all day today to figure it out. Thanks again Chris.
  • You can prevent distant Hotspots from being placed on a separate layer by unchecking Place distance Hotspots on separate layer? underneath "Hotspot settings" in the Settings Manager.
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.