using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Computer : MonoBehaviour {
public GameObject fpsCamera;
public GameObject Monitor;
public GameObject MonitorCamera;
public GameObject minimap;
public Transform DropPos;
public GameObject PurchasedItem;
public void turnOn()
{
fpsCamera.SetActive(false);
Monitor.SetActive(true);
MonitorCamera.SetActive(true);
minimap.SetActive(false);
Cursor.lockState = CursorLockMode.None;
Cursor.visible = true;
}
public void turnOff()
{
fpsCamera.SetActive(true);
Monitor.SetActive(false);
MonitorCamera.SetActive(false);
minimap.SetActive(true);
}
public void buyBox()
{
GameObject
newB = GameObject.Instantiate (PurchasedItem);
newB.gameObject.tag = "synthetic";
newB.transform.position = DropPos.position;
}
}
For some reason this code won’t unlock the mouse or make it visible, I tried using a tutorial and downloading somebody elses script directly but for some reason the mouse won’t unlock or become visible.
Script I downloaded:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MouseLock : MonoBehaviour
{
void Update()
{
if (Input.GetKeyDown("1"))
{
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = false;
}
if (Input.GetKeyDown("2"))
{
Cursor.lockState = CursorLockMode.None;
Cursor.visible = true;
}
}
}