using UnityEngine;
using System.Collections;
using UnityEngine.SceneManagement;
public class SceneManager : MonoBehaviour {
public void ChangeScene(string changeSceneTo)
{
SceneManager.LoadScene (changeSceneTo);
}
}
using UnityEngine;
using System.Collections;
using UnityEngine.SceneManagement;
public class SceneManager : MonoBehaviour {
public void ChangeScene(string changeSceneTo)
{
SceneManager.LoadScene (changeSceneTo);
}
}
How can you make such mistake. Look at the name of your class, it’s “SceneManager” and you are making a call to SceneManager.LoadScene(…);
And since you are also using the namespace of UnityEngine.SceneManagement; which also contains a class called SceneManager.
Now the compiler gives priority to the native class i.e. your SceneManager and when you make a call for load scene it looks for the method in your class and couldn’t find it thus giving out a definition missing error.
Now there are two possible solutions:
this should do. Also make sure you have included your scene in the build setting and the string input matches with the scene name.