using UnityEngine;
using System.Collections;
public class test : MonoBehaviour {
bool isPlaying = false;
void Start ()
{
Cursor.visible = false;
}
void Update ()
{
if(Input.GetKey(KeyCode.Escape))
{
isPlaying = !isPlaying;
if(isPlaying){
Screen.lockCursor = false; //the cursor is unlocked from center
Cursor.visible = true; //cursor is visible
}
else{
UnityEngine.Screen.lockCursor = true; //the cursor is locked to center
Cursor.visible = false; //cursor is invisibe
}
}
}
}
using System.Collections;
public class test : MonoBehaviour {
bool isPlaying = false;
void Start ()
{
Cursor.visible = false;
}
void Update ()
{
if(Input.GetKey(KeyCode.Escape))
{
isPlaying = !isPlaying;
if(isPlaying){
Screen.lockCursor = false; //the cursor is unlocked from center
Cursor.visible = true; //cursor is visible
}
else{
UnityEngine.Screen.lockCursor = true; //the cursor is locked to center
Cursor.visible = false; //cursor is invisibe
}
}
}
}
No comments:
Post a Comment