Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unity build setting error

I'm using Unity 5.6.0f3 and have come across this error when I try build and run. Ive checked in monodeveloper building and running script and it says build success. when I try for windows/mac/Linux standlone I get the below error messages.

Assets/Scripts/LevelManager.cs(4,19): error CS0234: The type or namespace name SceneManagement' does not exist in the namespaceUnityEngine'. Are you missing an assembly reference?

Assets/Scripts/LevelManager.cs(6,29): error CS0246: The type or namespace name `MonoBehaviour' could not be found. Are you missing an assembly reference?

Error building Player because scripts had compiler errors

.cs is as follows

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class LevelManager : MonoBehaviour {
    public void Loadevel(string name) {
        Debug.Log("Level load requested for: " + name);
        SceneManager.LoadScene(name);
        Debug.Log("Loaded Level " + name);
    }

    public void QuitLevel(string name) {
        Debug.Log("I want to Quit");
        Application.Quit();
    }
}

Im cant seem to find any answer on the net and am unable to figure it out at present.

like image 746
Fil Avatar asked Apr 16 '26 10:04

Fil


1 Answers

I had similar problem.

Reimporting assests didn't help, as restarting the computer, reinstaling the same version of unity and reinstalling visual studio.

Finnaly I got it to work by updating to unity beta.

like image 50
Ohad Cohen Avatar answered Apr 19 '26 01:04

Ohad Cohen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!