Forum rules - please read before posting.

During scene change: unwanted cursor icon change if hovering Hotspots and cursor sometimes flickers

[Unity 2019.4.40f1 - AC v1.75.3]

Hi!

A GIF of the issue(s) is available here

I'm experiencing two issues upon scene change:

  • When mouse is already over a Hotspot, the cursor grabs the default Use icon instead of the one I tell it to use via script for a few moments
  • Sometimes the cursor icon flickers, reverting back to the System cursor

So, here's some context:

  • The game uses the "legacy" input system, along with Rewired
  • The game uses Addressables and loads scenes asynchronously
  • The game can be played either in "point and click" mode or "direct" mode at any given time. When in "point and click" hotspots are detected and interacted with the mouse, when in "direct" mode they are detected by player vicinity and interacted with a controller button
  • My Hotspot Menu is a custom-made Unity UI Prefab.

Up until now I was using a heavily modified version of the Simultaneous Hotspot labels script attached to all of the Hotspots in the game but, since things were getting messy, as soon I had the chance I switched to using a single separate script, attached to a persistent GameObject.

Here's the code I use to handle Hotspots detection and interaction. The script is still much derived from the Simultaneous Hotspot labels' one, but it's definitely "slimmer" and cleaner than the one I used before.

And here's my current ControlSwitcher script, that handles whether you are using mouse\keyboard or a Gamepad anytime while playing the game.

These are my Cursor settings:

These are my Interface\Hotspot settings when in "point and click" mode

I hope it's enough information, but feel free to let me know if I missed something!

Is there something wrong I'm doing? I know I didn't delve directly in using a Custom Script for Hotspot Detection but I'm not sure if it's necessary and, if so, what would be the steps to start writing one (especially regarding the Hotspot activation for both the "direct" and "point and click" modes)

Thanks a lot in advance!

Comments

  • When mouse is already over a Hotspot, the cursor grabs the default Use icon instead of the one I tell it to use via script for a few moments

    I don't see the cursor changing icon, are you referring to the Hotspot icon?

    It's all going by too quick in your gif - can you share a video with padding and without cropping?

    Sometimes the cursor icon flickers, reverting back to the System cursor

    Is the system cursor showing in builds, or only the Editor?

    It may be just disappearing due to being in a cutscene. You can assign your main cursor graphic to the "Cutscene cursor" in the Cursor Manager, or prevent the ActionList from blocking gameplay.

  • edited July 2022

    Hi Chris!

    I recorded the GIF again, only showcasing the icon changing issue, slowed down a bit the frame where the issue appears and "signposted" it. I hope it makes more sense now!

    Basically that icon with the X should never appear as a cursor icon, and right now it appears momentarily if, while switching to a different scene, the cursor lands on an Hotspot from the get go.

    I wonder if this too is related to the Cutscene being blocking vs non-blocking, which is something that could be a bit of a pickle to address, even though I'm not 100% sure. I use OnStart Cutscenes extensively to keep track of a lot of "story-state variables" that lead to activating\deactivating hotspots, music, NPCs, etc. that I want to be happening as "seamlessly" as possible upon switching scenes.

  • I'll need to see the rest of your Cursor Manager, and the Inspector for the Hotspot in question.

    We'll also need to know if your custom script is a factor - does the issue occur if you disable your MyHotspotDetectionAndInteraction script?

  • edited July 2022

    Having successfully updated AC to v1.75.5 with the new "Change cursor when over single-use Interaction Hotspots" tickbox in the Cursor Manager it actually seems to be solving the issue of the appearing icon!

    Still I think the reason why the issue happened in the first place could be related to the fact that my "exits" Hotspots have a script attached that toggles their single-use interaction property when playing in "point and click" mode, according to a user-modifiable option.

    Basically we let players decide whether they want to:

    • Single-click to teleport to an exit
    • Double-click to teleport to an exit
    • Double-click to run to an exit
    private void Check()
    {
        int value = GlobalVariables.GetVariable(13).IntegerValue;
    
        switch (value)
        {
            case 0: //"SingleClickInstantExit"
                hotspot.oneClick = true;
                hotspot.GetFirstUseButton().playerAction = PlayerAction.DoNothing;
                hotspot.doubleClickingHotspot = DoubleClickingHotspot.DoesNothing;
                break;
    
            case 1: //"DoubleClickRunToExits":
                hotspot.oneClick = true;
                hotspot.GetFirstUseButton().playerAction = PlayerAction.WalkToMarker;
                hotspot.doubleClickingHotspot = DoubleClickingHotspot.MakesPlayerRun;
                break;
    
            case 2: //"DoubleClickInstantExit":
                hotspot.oneClick = true;
                hotspot.GetFirstUseButton().playerAction = PlayerAction.WalkToMarker;
                hotspot.doubleClickingHotspot = DoubleClickingHotspot.TriggersInteractionInstantly;
                break;
    
        }
    }
    

    Anyway, to answer your other questions, this is what happens, before updating AC, when I deactivate my Hotspot detection \ interaction script

    While hovering on an "exit" hotspot that carries the above mentioned script, the icon changes as shown in the screenshot until I move the cursor away.

    this is my full Cursor Manager (after the AC update, but it's basically the same as the one before the update). The "MouseOverHotspot" icon is only used inside the UI not on the cursor.

    So, yeah, I think the culprit is that WalkToExitsChecker script there, that ticks the Hotspots' "Single-use interaction?" box according to the user settings.

    This is how an Hotspot looks like when the game is not running

    At the start of the project we were planning to have different Hotspots to be interacted with using different buttons (e.g. either X or Y or A or B ), but eventually ended up just using one (X) and, even though I indeed use one interaction only, I have always had the Single-use interaction? unticked by default, because I didn't want the cursor to change icon.

    But for the "exits" Hotspot that has to change on the fly (via the script I posted above), because otherwise there's no way of assigning a double-clicking behaviour to it.

  • About the cursor flickering: I also tried switching back and forth between Scenes that have ActionList chains that run OnStart after setting them up to all run in the background, but the flickering still happens :\

  • When does the flickering occur, exacltly? Please also see my question about the behaviour in builds.

  • The flickering is momentary and it occurs almost every time I switch between scenes. I can't pin down possible reasons when it doesn't happen, but I'd say it happens at least 80% of the time, both in the Editor and in the builds.

    Here's another quick video, slowed down and "signposted" as the previous one

    It also happens when playing with a controller and the cursor is forced off. In that case it just flickers in the same spot the cursor was left to.

  • To be clear: the flickering you're mentioning is the system cursor showing up? The AC cursor still looks to be displayed underneath it.

    You can determine if/when AC is showing the system cursor by pasting the following at the bottom of the PlayerCursor scripts' SetCursorVisibility function:

    if (state) Debug.Log ("Show system cursor");
    
  • edited July 2022

    Yes, that's what I mean.

    When playing in "point and click" mode (with the AC cursor being always visible) the system cursor momentarily shows up over the AC cursor while, when playing in "direct" mode (with AC cursor being always off) the system cursor momentarily shows up on its own.

    I have placed the Debug.Log in the function as you suggested, but no message appears even when the "flickering" happens.

    To be more specific: the Debug.Log never executes as it is never reached

  • To be more specific: the Debug.Log never executes as it is never reached

    In that case, it may be turning on from a source other than AC.

    If you search your C# solution, are there any other instances of the line "Cursor.visible = true;"?

  • edited July 2022

    Troubleshooting this as you suggested I may have found the culprit! I looked for anything that changed the Cursor.visible state rather than just the lines that would set it to "true"

    In Pixel Crusher's Dialogue System there is a script named InputDeviceManager in which there are methods that force the cursor's visibility according to the value of a boolean passed on as a parameter. Commenting those lines the issue appears to be fixed.

    I think I should now pass this on to the Pixel Crusher's forums to address the issue and see if by doing so I'm not disrupting anything else 😅

    Still, thank you so much and sorry for not spotting earlier that the issue was coming from someplace different than AC!

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.