Added custom cursor

This commit is contained in:
Pasha Bibko
2026-01-20 15:23:59 +00:00
parent 12032c217c
commit db4ece3445
5 changed files with 141 additions and 4 deletions

View File

@@ -0,0 +1,27 @@
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;
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 353f192b40556e34dada2d432a9ffa85
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -27,8 +27,6 @@ namespace InterfaceOff.WorldScene
private void Awake()
{
/* Hides the cursor as a custom one is used */
/* Loads the JSON, temporary. TODO: Insert the JSON into this .cs file */
string json = File.ReadAllText(Application.dataPath + "/Resources/playerframe.json");
Frames = JsonUtility.FromJson<PlayerFrameInfoArray>(json).FrameInfo;