So I want to check if the player is in a specific level in the game I have been creating so that certain scripts can execute. However, I can’t quite seem to figure out how to get the scene’s name as a string. So far, this is the best I have done:
public string scene;
public bool inHouse = false;
void Start(){
scene = Scene.name;
}
void Update () {
{
if (scene = "House") {
inHouse = true;
}
}
With this set up, I have been getting two errors, which are as follows:
Assets/Scripts/PlayerActivate.cs(34,31): error CS0120: An object reference is required to access non-static member `UnityEngine.SceneManagement.Scene.name’
Assets/Scripts/PlayerActivate.cs(60,25): error CS0029: Cannot implicitly convert type string' to bool’
So what am I doing wrong? If you find out what to do, please elaborate, as I am still a beginner trying to understand c# 
TBruce
2
@shepsaus000
You either need to add a uses clause like so
using UnityEngine.SceneManagement;
or call Scene.name like so
scene = UnityEngine.SceneManagement.Scene.name;
also
if (scene = "House") {
inHouse = true;
}
needs to be
if (scene == "House") {
inHouse = true;
}
But depending on your game you could do it more efficiently like this
inHouse = (scene == "House");