My Problem is the following:
I´m trying to code a script for Unity with which I can change the scene when one specific Object was clicked. But I get the following error:
NewBehaviourScript.cs(19,21): error CS0176: Member 'SceneManager.LoadScene(string)' cannot be accessed with an instance reference; qualify it with a type name instead
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class NewBehaviourScript : MonoBehaviour
{
void Update()
{
if (Input.GetMouseButtonDown(0))
{
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
if (Physics.Raycast(ray, out hit))
{
if (hit.transform.name == "Cube")
{
SceneManager mySceneManager = new SceneManager();
mySceneManager.LoadScene("SceneTwo");
}
}
}
}
}