Hello, so I have the follow code here:
using UnityEngine;
using System.Collections;
public class GameManager : MonoBehaviour
{
public int forcurrentscore;
public int highscore;
public int currentlevel = 0;
public int lockedlevel;
void CompleteLevel()
{
currentlevel = +1;
Application.LoadLevel(currentlevel + 1);
}
}
The line that says "Application.LoadLevel(currentlevel + 1);" has an error saying that "Application.loadlevel(int)' is obsolete: Use Scencemanager.Loadscene".
**And when I am trying to call this void function from another script using the following code:**
void OnTriggerEnter(Collider other)
{
if (other.transform.tag == "Goal")
{
GameManager.CompleteLevel();
}
}
An error comes up saying: 'GameManager.CompleteLevel()' is inaccessible due to its protection level.
What do you guys recommend me to do?
Thank you for your help!
I am using C# by the way.
↧