What is wrong ?
Error said
Assets\Gamemanager.cs(18,22): error CS0120: An object reference is required for the non-static field, method, or property ‘SceneManager.GetActiveScene()’
What do it means???
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class Gamemanager : MonoBehaviour
{
public static LevelControl instance = null;
public GameObject completeLevelUI;
int sceneIndex, levelPassed;
void Start (){
//get the level index first.
sceneIndex = SceneManager.GetActiveScene ().buildIndex;
levelPassed = PlayerPrefs.GetInt ("LevelPassed");
}
public void CompleteLevel()
{
completeLevelUI.SetActive (true);
if (sceneIndex == 6)
Invoke ("loadMainMenu", 1f);
else {
if (levelPassed < sceneIndex)
PlayerPrefs.SetInt ("LevelPassed", sceneIndex);
}
}
}