Page 1 of 1

Cursor Disappears With Second Monitor

Posted: Mon Apr 22, 2024 11:16 pm
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

Re: Cursor Disappears With Second Monitor

Posted: Tue Apr 23, 2024 8:26 am
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.

Re: Cursor Disappears With Second Monitor

Posted: Wed Apr 24, 2024 3:59 pm
by DeidreReay
Thanks will take a look at what you showed. Now that can find when conversation is active should be simple.