Answer the question
In order to leave comments, you need to log in
unity. Interaction with objects?
In general, when I click on the computer, another scene opens for me - the desktop scene. But when you open it, there is no cursor. Why is that?
Here is the code for checking that the camera is looking at the computer, where when you click on E, scene number 2 opens.
using UnityEngine;
using UnityEngine.SceneManagement;
public class MonitorOnUse : MonoBehaviour
{
private bool isUsed;
void Start()
{
}
void Update()
{
if (!isUsed)
{
if (Physics.Raycast(Camera.main.transform.position, Camera.main.transform.forward, out RaycastHit obj, 6f))
if (obj.collider.tag == "Monitor")
if (Input.GetKey(KeyCode.E))
{
SceneManager.LoadScene(2);
}
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question