28 lines
570 B
C#
28 lines
570 B
C#
using UnityEngine;
|
|
|
|
public class FakeCursor : MonoBehaviour
|
|
{
|
|
public Camera AttachedCamera;
|
|
|
|
private void Start()
|
|
{
|
|
Cursor.visible = false;
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
Vector3 absolutePosition = new()
|
|
{
|
|
x = Input.mousePosition.x / Screen.width * 1920,
|
|
y = Input.mousePosition.y / Screen.height * 1080,
|
|
z = 5f
|
|
};
|
|
transform.position = AttachedCamera.ScreenToWorldPoint(absolutePosition);
|
|
}
|
|
|
|
private void OnDestroy()
|
|
{
|
|
Cursor.visible = true;
|
|
}
|
|
}
|