Quantcast
Channel: Questions in topic: "issue"
Viewing all articles
Browse latest Browse all 827

Unity 5.0 Cursor lock issue

$
0
0
I think everyone is having this issue because so far there aren't any answers to the problem. i changed my lock code script to work with the new Cursor.lockState code. BUT currently it's got the problem of not re grabbing the cursor to the center of the screen and it just goes where it wants. Here's my code. using UnityEngine; using System.Collections; public class PauseG : MonoBehaviour { public bool PauseGame = false; void Start(){ } void Update(){ // Pauseing Variables if(PauseGame == false){ Time.timeScale = 1; Cursor.lockState = CursorLockMode.Locked; }else{ Time.timeScale = 0; Cursor.lockState = CursorLockMode.Confined; } //Key check if(Input.GetKeyDown(KeyCode.Escape)){ if(PauseGame == false){ PauseGame = true; }else{ PauseGame = false; } } } } It has problems capturing the mouse unless I click in the window. Please help, this has been stressing me out for the past week.

Viewing all articles
Browse latest Browse all 827

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>