Added custom cursor

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

View File

@@ -9,6 +9,7 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 6997620146033860791}
- component: {fileID: 3265567963809100238}
m_Layer: 0
m_Name: Cursor
m_TagString: Untagged
@@ -26,12 +27,27 @@ Transform:
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_LocalScale: {x: 0.1, y: 0.1, z: 0.1}
m_ConstrainProportionsScale: 1
m_Children:
- {fileID: 7297418410848169550}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &3265567963809100238
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7563216493506774349}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 353f192b40556e34dada2d432a9ffa85, type: 3}
m_Name:
m_EditorClassIdentifier:
AttachedCamera: {fileID: 0}
ZValue: 8
Scale: 15
--- !u!1001 &7119938247261505957
PrefabInstance:
m_ObjectHideFlags: 0

View File

@@ -633,6 +633,7 @@ Transform:
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1003288350}
- {fileID: 1557857216}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!4 &1003288350 stripped
@@ -1195,6 +1196,100 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1001 &1557857215
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 782229191}
m_Modifications:
- target: {fileID: 3265567963809100238, guid: 15c9da29f34c88d4c82acf24cc874e3b,
type: 3}
propertyPath: Scale
value: 15
objectReference: {fileID: 0}
- target: {fileID: 3265567963809100238, guid: 15c9da29f34c88d4c82acf24cc874e3b,
type: 3}
propertyPath: ZValue
value: 8
objectReference: {fileID: 0}
- target: {fileID: 3265567963809100238, guid: 15c9da29f34c88d4c82acf24cc874e3b,
type: 3}
propertyPath: AttachedCamera
value:
objectReference: {fileID: 782229189}
- target: {fileID: 6997620146033860791, guid: 15c9da29f34c88d4c82acf24cc874e3b,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6997620146033860791, guid: 15c9da29f34c88d4c82acf24cc874e3b,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6997620146033860791, guid: 15c9da29f34c88d4c82acf24cc874e3b,
type: 3}
propertyPath: m_LocalPosition.z
value: 8
objectReference: {fileID: 0}
- target: {fileID: 6997620146033860791, guid: 15c9da29f34c88d4c82acf24cc874e3b,
type: 3}
propertyPath: m_LocalRotation.w
value: 0.7071068
objectReference: {fileID: 0}
- target: {fileID: 6997620146033860791, guid: 15c9da29f34c88d4c82acf24cc874e3b,
type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6997620146033860791, guid: 15c9da29f34c88d4c82acf24cc874e3b,
type: 3}
propertyPath: m_LocalRotation.y
value: -0.7071068
objectReference: {fileID: 0}
- target: {fileID: 6997620146033860791, guid: 15c9da29f34c88d4c82acf24cc874e3b,
type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6997620146033860791, guid: 15c9da29f34c88d4c82acf24cc874e3b,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6997620146033860791, guid: 15c9da29f34c88d4c82acf24cc874e3b,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: -90
objectReference: {fileID: 0}
- target: {fileID: 6997620146033860791, guid: 15c9da29f34c88d4c82acf24cc874e3b,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7563216493506774349, guid: 15c9da29f34c88d4c82acf24cc874e3b,
type: 3}
propertyPath: m_Name
value: Cursor
objectReference: {fileID: 0}
- target: {fileID: 7563216493506774349, guid: 15c9da29f34c88d4c82acf24cc874e3b,
type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 15c9da29f34c88d4c82acf24cc874e3b, type: 3}
--- !u!4 &1557857216 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 6997620146033860791, guid: 15c9da29f34c88d4c82acf24cc874e3b,
type: 3}
m_PrefabInstance: {fileID: 1557857215}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &1758685209
PrefabInstance:
m_ObjectHideFlags: 0
@@ -1203,6 +1298,11 @@ PrefabInstance:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 1912500691838987139, guid: e29ce1fe47a855c4e907d4312c9e9d6e,
type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2020022267469913571, guid: e29ce1fe47a855c4e907d4312c9e9d6e,
type: 3}
propertyPath: m_Name

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;