Forum rules - please read before posting.

Revert Cursor back to previous

I've searched around and can find similar things but nothing exactly like my issue. I have certain segments where I need to disable the cursor and lock it (essentially a first person view so that the player can move the camera in FP view without showing a visible cursor).

My issue is that when I press Esc to access pause menu the cursor stays invisible (it does at least unlock though which is good, I know this because I can move the invisible cursor around and the menu items get highlighted when this invisible cursor moves over them). When I resume the game and exit the menu then the cursor becomes locked again and everything works perfectly.

I thought about inserting actions on the 'When turn off' and 'When turn on' action lists for the menu however whilst I have no issue enabling the cursor as being visible when the menu is turned on I can't simply then make it invisible when turning the menu off because there are obviously segments in my game where the cursor is indeed then visible and in these segments if I made the cursor go invisible when exiting the menu then this would be wrong for these segments.

When entering and exiting the menu the system does a great job of reverting the 'locked status' of the cursor - so when entering a menu the system knows to ensure the cursor is unlocked however when exiting the menu the system doesn't simply then lock the cursor, it knows that it must then revert the cursor back to how it was before pausing so surely there must be a way of doing the same thing with the cursor visibility?

p.s. looking for a solution I have realised that 'locking the cursor' is done using the Player: Constrain action however I've previously been calling the Toggle Cursor action within the player cursor script of the GameEngine object? Really not sure why I did this (was more than 12 months ago that I started this project and have been away from it for nearly 10 months so can't recall why I did this). Just wanted to check if the Constrain action has always been available?

Comments

  • The Constrain Action's long been a feature, but the ability to control the cursor in it was introduced in v1.50.

    The cursor should automatically be made visible once unlocked - you should only need a Player: Constrain Action to actually lock/unlock the cursor itself.

    Some questions to try to pin the issue down:
    1. Are you relying on Software of Hardware rendering for your cursor (as set in the Cursor Manager)?
    2. What platform are you working on, and is this in builds only or the Editor as well?
    3. What version of AC are you using?  If not the latest (v1.55c), please back up your project and upgrade - we'll need to know if this is a current issue.
  • edited February 2017
    Chris,

    Thanks again for the quick response, it really does make a huge difference! I mentioned in a previous post however I've had nearly 12 months off my project so I must have only just been exposed to the new cursor constrain option during the last week when I've returned to AC which explains why I was previously using the ToggleCursor in the PlayerCursor script in the game engine object!

    Regarding your questions I can confirm that I am using the latest version (1.55c), my cursor is Software rendered and I'm working on PC (I've only ever ran in the editor, I can build the game though or just a scene and test it out in a game build though). Although to be honest I recall this being an issue for quite a while but it has always been a bug (in my game I think, not in Adventure Creator) that I've seen as low priority as it seemed something that should be an easy fix.

    So essentially when I press Esc to enter the menu and the cursor is 'unlocked' then by default this should also make my previously invisible cursor become visible again? And then visa versa when I exit the menu and the cursor reverts back to being locked then the cursor should also revert back to being invisible too?
  • Yes, although if you're running any custom code that conflicts with it then it may be affected by it.  You mentioned this has always been a bug in your game, not AC - what do you mean by this exactly?

    Certainly you should check to see if it occurs in builds.  Also try temporaririly switching your Cursor Manager asset to Demo_CursorManager, so that you're using the default asset and we can see if the issue is with the way that's set up or not.

    I'm assuming you have Hide cursor when locked in screen's centre? checked in your Settings Manager.  Could you provide a shot of that whole section of the Settings Manager?
  • Chris,

    My comment about it being a bug in my game was simply me saying that it has been something I have had in my 'bug notes' as something that I needed to fix for a while (I keep a list of issues I find with my game during test runs so I can rectify them) - so when I drafted my comment above I initially referred to the issue I'm encountering as a bug however upon re-reading it sounded like I was attributing the behaviour to a bug in your AC plugin and so I changed the wording to state that I'm certain it is an issue with my game and something I've done as opposed to your plugin so to not cause offence (especially since pretty much now 100% of my issues that I've had have either been down to me or Unity)!

    I shall check my settings when I am back home (to be honest when I am locking the cursor via an action list I've also been making the cursor invisible via the same action list as I do not recall the option to automatically hide the cursor when it is locked in the screen's centre). To be honest this now sounds like the solution right there so I'm hoping when I get home tonight I'll check my settings manager and realise that this option is unchecked (I hope).

    The plus side for that would be that my problem is fixed however if so then all of this has been down to an extremely simple fix that I've somehow missed all this time so apologies for the time wasted! Thanks again and I'll give a quick update tonight hopefully confirming the fix.

    Mike.
  • No offence taken - just trying to clarify the issue.

    Please let me know how it goes - if this was caused by using an AC Action, then it could well be a bug - easy solution or not.
  • Chris,

    All sorted now mate, I've stopped using the old method of 'ToggleCursor' and instead I'm using the Player: Constrain action to lock the cursor and then with the option to 'always hide the cursor when locked' in the Settings section of the Scene Manager I'm not having the issue any more.

    Well sort of solved, initially when doing the aforementioned changes the cursor would show up when I accessed the pause menu and unlock as desired however when resuming the game the cursor would lock back in however would then be visible rather than reverting back to hidden. However I took another piece of your advice above and ran a build of the level and in the build the cursor works perfectly as desired in all scenarios (only in the editor itself does it not hide again when exiting the pause menu). This is a completely non-issue for me and obviously I'd prefer it this way than the other way around, so consider this problem solved mate.

    Thanks again for your continued help.

    Mike.
  • Glad to hear it - thanks for the update, and you're welcome!
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.