Forum rules - please read before posting.

Managing Hotspots Over Scenes

Ambiguous title and probably not accurately reflecting my problem however I'll try to explain. I have an NPC that has 2 different hotspots on them with only one of them being active at one time depending on what player is currently in use. I've previously used the 'limit hotspot to camera' as well as the 'enable/disable hotspot action' to manage whether hotspots are on or off however in this situation I'm struggling.

So NPC has 2 hotspots (call them A and B), if I use the enable/disable option then as far as I can see when using it this will not be able to differentiate between two separate hotspot scripts on the same NPC/Gameobject. So I try to limit Hotspots A and B to certain cameras however the trouble I have there is that the camera that is in use when Hotspot A is needed to be active is then not present in the scene when Hotspot B is required therefore Hotspot A is not able to be limited by a camera (because that camera is missing from the scene) and therefore by default becomes active again and blocks access to Hotspot B.

To explain a little further; when Hotspot A is active then the camera it is limited to is the FPS camera of the player, the problem is that later in the game the player changes to a different character (hence why I am having issues when trying to limit Hotspot A to Player A camera because when Player B becomes active later in the game and I require only Hotspot B to be active then I have the aforementioned issue of Hotspot A limit to camera not working because Player A is not in the scene and therefore unable to limit to their FPS camera).

A simple solution would be to have just one hotspot and then when clicked it will check whether Player A or B is active and then run the appropriate action list however Hotspot A is a single click interaction whilst Hotspot B has a few different options (and this is something that I cannot change for gameplay purposes) and so asking the game to check which Player is active after clicking the hotspot is too late since it would need to know that before the hotspot is even clicked.

Hopefully I've explained myself well enough, I'm still very much a noob to all this :)

Comments

  • It's a complicated-sounding issue, to be sure.

    While NPCs are generally expected to have a single Hotspot on them, a caveat of the system (common to many Unity components in general) is that there only be one Hotspot on each GameObject.  This is because - as you correctly said - it has trouble determing which component you refer to in Actions / script.

    You should be able to get around this, however, by simply placing the Hotspot B on a child object.  You'll likely need another Trigger Collider on it to "catch" mouse clicks, but if you also attach the Remember Hotspot component to both Hotspots, you can set their Hotspot state on start fields to control their initial states separately.
  • Chris,

    I feel so stupid, attaching the second hotspot onto a child of the NPC was the first thing I did however when that hotspot was unclickable I dismissed the option thinking the hotspot was being detected by all the additional components that make up the NPC (completely forgetting that the only component I'd need is a collider)! Feel quite silly, I'll test it out today when I get back will let you know. Thanks again 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.