Forum rules - please read before posting.

Showing Cursor for P&C Puzzle

I am Switching to Point & Click gameplay for a puzzle in my (predominantly direct-controlled) game that has Cursor set to Never visible. I have used actions to enable the cursor (Manage Systems) and disable the cursor lock (Player Constrain), but the cursor remains invisible.

Isn't there a way to just make the cursor visible (then invisible again)?

Or alternatively, is there a way to switch the texture of the cursor - I could have a transparent one that's always visible for general gameplay, then switch to a more visible one when I need to use it for a puzzle / menu etc.

Comments

  • edited April 2021

    The Cursor system is enabled by default - that the Main cursor texture is not shown doesn't disable the system itself, since it can still be used for e.g. inventory items.

    If you're looking to change e.g. the Cursor Manager's Display cursor setting at runtime, you can do so with script. Right-click on any Manager field label to get an API reference to it. In the case of the above, it's:

    AC.KickStarter.cursorManager.cursorDisplay
    

    These two functions, placed in a new C# script, can be used to show/hide the main cursor:

    public void ShowCursor ()
    {
        AC.KickStarter.cursorManager.cursorDisplay = CursorDisplay.Always;
    }
    
    public void HideCursor ()
    {
        AC.KickStarter.cursorManager.cursorDisplay = CursorDisplay.Never;
    }
    

    To call them from an AC ActionList, attach the script to a new GameObject, make it a prefab, and then use the Object: Call event Action to invoke the functions on that prefab.

    Just bear in mind that runtime changes made to Manager fields will survive exiting Play Mode, so you'll need to run a similar Action in your Settings Manager's "ActionList on start game" asset to set the cursor display to Never when the game begins.

  • Awesome, working straight away, thank you.

    There is something else I'd overlooked though; my puzzle's hotspots don't work because their detection method is set to Player Vicinity. Is there a way to change this to Mouse Over at runtime? The API reference states this as:

    AC.KickStarter.settingsManager.hotspotDetection

    Not sure what else to include in this script though, as far as variables are concerned & how they are supposed to be written in the code; I need Mouse Over & Player Vicinity (for when switching back to direct control).

  • For details on how a given field can be updated, search for it in the Scripting Guide. The entry for "hotspotDetection" can be found here.

    To modify this at the same time as the cursor:

    public void ShowCursor ()
    {
        AC.KickStarter.cursorManager.cursorDisplay = AC.CursorDisplay.Always;
        AC.KickStarter.settingsManager.hotspotDetection = AC.HotspotDetection.MouseOver;
    }
    
    public void HideCursor ()
    {
        AC.KickStarter.cursorManager.cursorDisplay = AC.CursorDisplay.Never;
        AC.KickStarter.settingsManager.hotspotDetection = AC.HotspotDetection.PlayerVicinity;
    }
    
  • Working great, thanks a lot Chris.

  • I've run into an issue with this; Dialogue text does not display. The interaction still happens (you can tell because the cursor gets hidden) but the dialogue text does not show for some reason.

  • The code above shouldn't have anything to do with how dialogue is displayed. You're saying that by commenting it out, it shows again?

    Try placing comments in your ActionList to see if they get output to the Console.

    Are you using speech audio, and what's your menu's Source? Try it without audio and with an AC menu.

  • edited April 2021

    Which part of the code should I comment out to test?

    I placed comments in the ActionList and they were printed in the console, so the action is definitely firing, just not displaying the text.

    There is no speech audio being used, it is just Narration text set to display as an examine interaction. The Subtitles menu is the default AC menu.

    EDIT: Also, fwiw I'm still on AC 1.73.2, Unity 2018.3.14.

  • Which part of the code should I comment out to test?

    Start with the whole script, then the bodies of the ShowCursor / HideCursor functions above.

  • edited April 2021

    As you predicted, it is totally unrelated to the script. I had an action running to disable menus, forgetting that subtitles are considered a menu. Oops! :D

    I suppose I'll have to lock the relevant menus individually.

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.