Cursor Disappears With Second Monitor

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
DeidreReay
Posts: 93
Joined: Wed Jan 22, 2020 1:20 pm

Cursor Disappears With Second Monitor

Post by DeidreReay »

Customer states that if during a dialogue and they can
1.) Move their cursor out of their monitor onto a second monitor
2.) If clicking out of game then back in they lose their cursor.

I feel like I can script something up to stop the cursor from moving out of the game, and also make sure it is shown when back in game, but wondering is there a bool or anything for when Players are in a conversation that I could subscribe to?

3.) It seems that when dialogue has started and get the mouse to interact can then move off of the Screen to other monitors (although when not in dialogue players can not do so from doing this

Cursor.lockState = CursorLockMode.Confined;
Is there something in the dialogue code that is over riding that? If possible would like to be able to make sure the cursor stays in game even when in dialogue.
Thanks in advance Tony
User avatar
Tony Li
Posts: 22112
Joined: Thu Jul 18, 2013 1:27 pm

Re: Cursor Disappears With Second Monitor

Post by Tony Li »

Hi,

Can the player also lose their cursor if they don't move the mouse into the second monitor, and they just click in the game's monitor?

To check if a conversation is active, check DialogueManager.isConversationActive.

If the Dialogue System unlocks the cursor for a conversation, it sets the lock state to CursorLockMode.None. You could wait a frame and set it to Confined by adding a script to the Dialogue Manager:

Code: Select all

public class ConfineCursorDuringConversation : MonoBehaviour
{
    void OnConversationStart(Transform actor)
    {
        StartCoroutine(ConfineCursorAfterFrame());
    }
    IEnumerator ConfineCursorAfterFrame()
    {
        yield return null;
        Cursor.lockState = CursorLockMode.Confined;
    }
}
In the next update, I'll also add a property that you can set to tell the Dialogue System to use Confined instead of None when showing the cursor.
DeidreReay
Posts: 93
Joined: Wed Jan 22, 2020 1:20 pm

Re: Cursor Disappears With Second Monitor

Post by DeidreReay »

Thanks will take a look at what you showed. Now that can find when conversation is active should be simple.
Post Reply