This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using UnityEngine; | |
| public class WorldToScreen : MonoBehaviour { | |
| /// <summary> | |
| /// Get the WorldToScreenPosition translated to be used with UI elements inside a Canvas. | |
| /// </summary> | |
| /// <param name="worldObj">Object in the world to follow.</param> | |
| /// <param name="canvas">Canvas transform that holds the UI object we want to move.</param> | |
| /// <param name="cam">Camera to calculate the screen position. If null will use Camera.main (optional).</param> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using UnityEngine; | |
| public class CursorMode { | |
| /// <summary> | |
| /// Switch the current cursor mode to enabled, including Cursor.visible(true) and Cursor.lockState(None). | |
| /// </summary> | |
| public static void Enable() { | |
| Cursor.visible = true; | |
| Cursor.lockState = CursorLockMode.None; |