Forum rules - please read before posting.

Hotspot Detection Method

edited December 2023 in Technical Q&A

Hello,

I believe I have encountered a bug related to the Hotspot Detection method. When I modify the method through a custom script action, alternating between 'mouse' and 'vicinity', the hotspot ceases to be detected.

Here is the custom action script

`public override float Run ()
    {
        AC.KickStarter.settingsManager.hotspotDetection = HotspotDetection.MouseOver;


        if (!isRunning)
        {
            isRunning = true;
            return defaultPauseTime;
        }
        else
        {
            isRunning = false;
            return 0f;
        }
    }`

I only edited this part, everything else is the same.

I have unity 2023
and Latest AC update

Comments

  • As the Action only needs to run once, you can simplify it to:

    public override float Run ()
    {
        KickStarter.settingsManager.hotspotDetection = HotspotDetection.MouseOver;
    }
    

    Which method are you having trouble with, and do you have issues if you set that method as the default within the Settings Manager, before changing it at runtime?

  • > As the Action only needs to run once, you can simplify it to:
    
    public override float Run ()
    {
        KickStarter.settingsManager.hotspotDetection = HotspotDetection.MouseOver;
    }
    

    I set it like this and I got this error:

    "ActionChangeHotspotDetectionToMouse.cs(34,25): error CS0161: 'ActionChangeHotspotDetectionToMouse.Run()': not all code paths return a value"

    and I fixed it with:

    `public override float Run ()
    {
                        AC.KickStarter.settingsManager.hotspotDetection = HotspotDetection.MouseOver;
    
        return 0;
    }`
    

    Which method are you having trouble with, and do you have issues if you set that method as the default within the Settings Manager, before changing it at runtime?

    -Both methods have this issue when switching from mouse to vicinity or from vicinity to mouse.
    -No issue with the default method. It just stops working when changing the detection method via this action script.

  • edited December 2023

    and I fixed it with:

    Quite right.

    No issue with the default method. It just stops working when changing the detection method via this action script.

    Thanks for the details - I'll attempt a recreation. Does the issue also occur if - instead of running the Action - you manually change the "Hotspot detection method" field at runtime in the Settings Manager?

  • edited December 2023

    Does the issue also occur if - instead of running the Action - you manually change the "Hotspot detection method" field at runtime in the Settings Manager?

    Yes, even when changing it manually through the settings manager the issue is still there.

  • When set to "Player Vicinity", uncheck Place distant Hotspots on separate layer?.

  • Thanks Chris. It works fine now even with the custom script.

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.