SceneManager.sceneLoaded Cannot Implicityly convert type int to...
Hey everyone.
I have a script that is being used to run my menus and character selection. The intention is to use
//Checks player one's character
//Spawns selected character
void SpawnP1()
{
if(P1Char == "CharOne")
{
GameObject character = Instantiate(Char1, SpawnA.position, SpawnA.rotation);
}
}
//Calls the character spawn script for player one
void OnEnable()
{
SceneManager.sceneLoaded += SpawnP1();
}
Problem is it is giving me an error: "Cannot implicitly convert type 'void' to 'UnityEngine.Events.UnityAction < UnityEngine.SceneManagement.Scene, UnityEngine.SceneManagement.LoadSceneMode >'"
Maybe because my "SpawnP1()" function is void? Switching it to public doesn't do the trick. I'm sure it has to be me using it incorrectly, but the documentation on "OnEnable" and "SceneManager.sceneLoaded" are a little sparse.
Thoughts?
Your answer
Follow this Question
Related Questions
Having an issue with disappearing Music Player UI when switching scenes 0 Answers
SceneManager.LoadScene freezes in published build 2 Answers
Sound doesn't always play 0 Answers
How do I change scenes with a delay after pressing a button? 1 Answer
C# scripts not showing up in scene... please help! 0 Answers