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#