0

Change cursor paramaters lock bug

John 3 weeks ago in Game Creator updated 2 weeks ago 13
Unity version:
2019.4.11f1
Game Creator version:
1.1.10 Patch

Sorry, forgot to add the details. 

So for context, I am trying to lock my cursor in the middle of the screen while in first person view to have a similar set up to the elder scrolls series for my RPG game.

On the action "Change cursor parameters" when the "Cursor Lock Mode" is set to none the mouse is fine and visible. The mouse can be move freely in and out of the game view.

When set to locked the cursor is gone. I tried to see if it was just invisible and just locked to the centre of the screen but it seems to be completely gone.

And when set to confined, it can be freely moved about but only in the game view as to be expected.

I tried this with the "Change Texture" on and off, as well as the "Change Visibility" on and the "Is Visible" on and off and with the "Change Visibility" off. The mouse pointer is always disabled and not visible when the cursor mode is set to locked.

+1

Hi there.

I think there's a workaround for that.

if you want a HuD like Elder Scrolls RPGs with a crosshair in the middle that changes with the action and environment you need to take a look at GC documentation and search for animated crosshairs and the trigger On Mouse Hover.

So the thing is your mouse cursor must be locked and will not be visible and that's ok, but if you use the on mouse hover trigger with animated crosshairs and also some others types of triggers, like crouching, jumping, so on and so forth, you will be able to put together a project with a HUD very similar to TES series.

I think I understand what you are getting at. I'll give that a try. Thank you.

You're welcome.

Btw, in the GC tutorial site there's a section for the Shooter Module. Inside it there's a link on how to make a animated crosshair from the scratch. I think it will help you to make a more pro looking crosshair with dynamic transitions. It's a great turorial tha will help in other aspects too.

Thank you. I'm just working on mechanics right now. Once I have built out my functionality I plan to go back and polish things up. I'll bookmark it though so I can look into it later.

So I forgot to mention that the mouse is not only invisible when the locked state is on. It's disabled. I was originally just going to put a UI element in the middle of the UI to let the player know where the pointer is, but the on left click action was no longer working when the mouse lock state was enabled. So unless I'm missing something else, that is why I haven't been able to figure this out. I was using the inventory module example scene in it's default state when I tried to do this.

I have all of the modules but I'm not seeing an On Mouse Hover trigger in the documentation or my triggers

list.

When Locked, the cursor is placed in the center of the view and cannot be moved. The cursor is invisible in this state, regardless of the value of Cursor.visible.  -  https://docs.unity3d.com/ScriptReference/Cursor-lockState.html

This is a Unity constraint and not a Game Creator Problem.

Not a Bug.

I understand, Thanks

Aso it's not just invisible, it's disabled. The on left click no longer works when the mouse is locked. I was going to just put a UI to let the player know where it is but it's disabled completely. That's why I have been struggling with this. Just FYI. Unless there was something else going on that I didn't see.

Ok, for anyone else having this issue. I've figured it out. The cursor lock does not work with the On Left Click trigger for some reason. That is the default set up for the items in the inventory example of the inventory module. If the trigger is set to On Hover Press Key, it works fine even when the cursor is set to locked. I'm not sure if that is a Unity or GC issue but I've found a solid work around now. Thank you to JSonMac for pointing me in the right direction and Vexstorm for the help in Discord.

+1

Nice man, glad I was able to help you somehow. Good luck with the project!