chore: initial commit
This commit is contained in:
31
Assets/Feel/MMTools/Accessories/MMGUI/MMCursorVisible.cs
Normal file
31
Assets/Feel/MMTools/Accessories/MMGUI/MMCursorVisible.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace MoreMountains.Tools
|
||||
{
|
||||
/// <summary>
|
||||
/// Add this class to an object and it'll make sure that the cursor is either visible or invisible
|
||||
/// </summary>
|
||||
[AddComponentMenu("More Mountains/Tools/GUI/MMCursorVisible")]
|
||||
public class MMCursorVisible : MonoBehaviour
|
||||
{
|
||||
/// The possible states of the cursor
|
||||
public enum CursorVisibilities { Visible, Invisible }
|
||||
/// Whether that cursor should be visible or invisible
|
||||
public CursorVisibilities CursorVisibility = CursorVisibilities.Visible;
|
||||
|
||||
/// <summary>
|
||||
/// On Update we change the status of our cursor accordingly
|
||||
/// </summary>
|
||||
protected virtual void Update()
|
||||
{
|
||||
if (CursorVisibility == CursorVisibilities.Visible)
|
||||
{
|
||||
Cursor.visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Cursor.visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user