fuck cursors

This commit is contained in:
Cat Flynn 2021-05-18 20:40:41 +01:00
parent cce374d0ec
commit 83ccb63d81
2 changed files with 75 additions and 9 deletions

View File

@ -26,8 +26,8 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2832368838255871049}
m_LocalRotation: {x: -0.0981706, y: -0.8403349, z: -0.5077412, w: 0.16247682}
m_LocalPosition: {x: 0.06260109, y: -1.2571502, z: 0.0135195255}
m_LocalRotation: {x: -0.32762, y: 0.039359666, z: 0.013661557, w: 0.9438906}
m_LocalPosition: {x: 0.111852646, y: -0.7848649, z: -1.4280012}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 5661344206969957946}
@ -169,6 +169,8 @@ GameObject:
- component: {fileID: 5661344207112327338}
- component: {fileID: 8137033370021049976}
- component: {fileID: 8846952043387883595}
- component: {fileID: 9022933136415910108}
- component: {fileID: 7759226110151452104}
m_Layer: 0
m_Name: Main_Camera
m_TagString: MainCamera
@ -183,8 +185,8 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5661344207112327339}
m_LocalRotation: {x: -0.0981706, y: -0.8403349, z: -0.5077412, w: 0.16247682}
m_LocalPosition: {x: 0.06260109, y: -1.2571502, z: 0.0135195255}
m_LocalRotation: {x: -0.32762, y: 0.039359666, z: 0.013661557, w: 0.9438906}
m_LocalPosition: {x: 0.111852646, y: -0.7848649, z: -1.4280012}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 5661344206969957946}
@ -319,6 +321,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 9d54716c6690d97469638748463784b8, type: 3}
m_Name:
m_EditorClassIdentifier:
_hideOnStart: 1
--- !u!114 &8846952043387883595
MonoBehaviour:
m_ObjectHideFlags: 0
@ -333,6 +336,62 @@ MonoBehaviour:
m_EditorClassIdentifier:
attenuationObject: {fileID: 0}
ListenerNumber: -1
--- !u!114 &9022933136415910108
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5661344207112327339}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0a5de09a27d949d4db67034f55c57e6b, type: 3}
m_Name:
m_EditorClassIdentifier:
_event: {fileID: 11400000, guid: 0fc36e00903fc7047b48bb1844e6f12b, type: 2}
_response:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 8137033370021049976}
m_TargetAssemblyTypeName: HideandLockCursor, Assembly-CSharp
m_MethodName: ShowCursor
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
--- !u!114 &7759226110151452104
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5661344207112327339}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0a5de09a27d949d4db67034f55c57e6b, type: 3}
m_Name:
m_EditorClassIdentifier:
_event: {fileID: 11400000, guid: d8c4272694282b64e9cd1d4a42477262, type: 2}
_response:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 8137033370021049976}
m_TargetAssemblyTypeName: HideandLockCursor, Assembly-CSharp
m_MethodName: HideCursor
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
--- !u!1 &5661344207311831626
GameObject:
m_ObjectHideFlags: 0
@ -762,8 +821,8 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5661344207789115490}
m_LocalRotation: {x: 0.0981706, y: 0.8403349, z: 0.5077412, w: -0.16247682}
m_LocalPosition: {x: 0.06260109, y: -1.2571502, z: 0.0135195255}
m_LocalRotation: {x: 0.12201034, y: 0.75759476, z: 0.623868, w: -0.1481634}
m_LocalPosition: {x: 0.062561035, y: -1.2605112, z: 0.013054132}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 5661344207439169721}

View File

@ -4,16 +4,23 @@ using UnityEngine;
public class HideandLockCursor : MonoBehaviour
{
[SerializeField] private bool _hideOnStart;
// Start is called before the first frame update
void Start()
{
if (_hideOnStart) HideCursor();
}
public void HideCursor()
{
Cursor.visible = false;
Cursor.lockState = CursorLockMode.Locked;
}
// Update is called once per frame
void Update()
public void ShowCursor()
{
Cursor.visible = true;
Cursor.lockState = CursorLockMode.None;
}
}