Reputation: 64
I'm not understanding what's wrong with this implementation. Perhaps someone could shed some light on the issue. The compiler is stating that there is no overloaded method for StartGame that matches the delegate. Am I missing something silly here?
void Start()
{
SceneManager.sceneLoaded += this.StartGame;
director = GetComponent<Director>();
}
public void LoadGameLevel()
{
SceneManager.LoadScene("Debug");
}
void StartGame(UnityAction<Scene, LoadSceneMode> sceneInfo)
{
foreach (GameObject player in players)
{
Instantiate(player);
}
}
Upvotes: 1
Views: 1755
Reputation: 125315
This is how the event is defined: public static event UnityAction<Scene, LoadSceneMode> sceneLoaded;
Replace
StartGame(UnityAction <Scene, LoadSceneMode> sceneInfo)
with
void StartGame(Scene scene, LoadSceneMode sceneMode)
.
That should solve your problem.
Upvotes: 6