
Unity
126
Вклад в тег
using UnityEngine;
public class MouseCenteringExample : MonoBehaviour {
private void Start() {
Cursor.lockState = CursorLockMode.Locked;
Invoke("UnlockCursor", 0.05f);
}
private void UnlockCursor() => Cursor.lockState = CursorLockMode.None;
}
using UnityEngine;
public class MouseCenteringExample : MonoBehaviour {
private void Start() {
var center = Screen.safeArea.center;
Mouse.current.WarpCursorPosition(center);
InputState.Change(Mouse.current.position, center);
}
}
using System.Runtime.InteropServices;
using UnityEngine;
public class MouseCenteringExample : MonoBehaviour {
#if UNITY_STANDALONE_WIN
[DllImport("user32.dll")]
static extern bool SetCursorPos(int X, int Y);
private void Start() {
var center = Screen.safeArea.center;
SetCursorPos((int)center.x, (int)center.y);
}
#endif
}
Object r = 13.1;
if (r instanceof Double) {
System.out.println("matches double");
}
String example = "1331.2";
if (Pattern.matches("^[\\+\\-]{0,1}[0-9]+[\\.\\,][0-9]+$", (CharSequence) example)) {
System.out.println("matches double");
}
private void Update() {
if (Input.GetKeyDown(KeyCode.Escape)) {
// your code
}
}
private void Update() {
if (Input.GetKeyDown(KeyCode.Escape))
OnPauseStart();
}
public void OnPauseStart() {
// your code
}
private void Update() {
if (Application.platform == RuntimePlatform.Android) {
if (Input.GetKeyDown(KeyCode.Escape)) {
// your code
}
}
}