Forum rules - please read before posting.

Change hotspot interaction method in different scenes

Hi Chris,

I make a 3d direct game in AC.
In one scene, I would like the hotspot detection method be "Player Vicinity", the player can run near to hotspot for interaction. (Something like third person view)
In another scene, I would like the hotspot detection method be "Mouse over", I do not need the player in this scene, only set the camera active and click the hotspot in the scene by mouse. (Something like first person view)
I can run each scene properly if I change the hotspot setting manually.
However, is AC has any way to let me change the hotspot detection method in runtime/by action list?
Would you please advise, thanks a lot.

Comments

  • Any Manager field can be changed at runtime through custom script.

    To get an API reference to a given field, right-click on its label and choose "Copy script variable". In the case of the "Hotspot detection method", this is:

    AC.KickStarter.settingsManager.hotspotDetection
    

    Here's a simple script with two functions that sets it to either Player Vicinity or Mouse Over:

    using UnityEngine;
    using AC;
    
    public class ChangeHotspotDetection : MonoBehaviour
    {
    
        public void MouseOver ()
        {
            KickStarter.settingsManager.hotspotDetection = HotspotDetection.MouseOver;
        }
    
        public void PlayerVicinity ()
        {
            KickStarter.settingsManager.hotspotDetection = HotspotDetection.PlayerVicinity;
        }
    
    }
    

    Add it to a GameObject, make it a prefab, and delete the GameObject from the scene.

    When you want to change the value, use the Object: Call event Action, and create an event that refers to the prefab and calls the appropriate function in the component.

    Be aware, though, that any changes you make to a Manager field will survive Play Mode - so you'll need to set it to your intended default value when the game begins. This can be done with an "ActionList on start game" asset, which you can assign in the Settings Manager.

  • Trying this now, but it seems that when I set Hotspot detection method to "Mouse Over" the hotspots are still set to OFF when I hover over them. I can see their highlight icons pop up, so that's working, but clicking on it doesn't seem to do anything. This remains true regardless of if I change to "Mouse Over" via script or just manually while playing.

  • By "set to OFF", are you specifically referring to the "Current state: OFF" message that appears in the Inspector of a disabled Hotspot?

    What layer is the Hotspot on, and do you have Place distant Hotspots on separate layer? checked when set to "Player Vicinity"?

  • Whoop it was definitely the Place distant Hotspots on separate layer! Makes sense that would mess with it, thanks!

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.