Advertisement
sphinx2001

My_GUI

Mar 7th, 2020
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.63 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class My_GUI : MonoBehaviour
  6. {
  7.     // Start is called before the first frame update
  8.     private Camera _camera;
  9.     void Start()
  10.     {
  11.         _camera = GetComponent<Camera>();
  12.         Cursor.lockState = CursorLockMode.Locked;
  13.         Cursor.visible = false;
  14.     }
  15.  
  16.     // Update is called once per frame
  17.     void OnGUI()
  18.     {
  19.         int size = 40;
  20.         float posX = _camera.pixelWidth / 2 - size / 4;
  21.         float posY = _camera.pixelHeight / 2 - size / 4;
  22.         GUI.Label(new Rect(posX, posY, size, size), "*");
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement