Sorry, this may be a beginner question but I’m having trouble changing the scene after two objects are destroyed (set active false) I have a game where the goal is to shoot all of the targets. I want it so that when the 2 objects disappear, the player proceeds to the next scene/next level. The actual scene change works, just not the if statement.
Here is my current script:
void Start ()
{
}
void Update ()
{
if (gameObject.SetActive (false))
{
SceneManager.LoadScene ("Level2");
}
}
(By the way, I have the lines before the void Start thing all fine)
When I run this script an error message like this shows up next to the “if (gameObject.SetActive (false))” line:
Cannot implicitly convert type ‘void’ to ‘bool’
This message points to the S in “SetActive” on that line.
I’m new to this scripting stuff so I don’t know what these error messages mean. I know it’s probably really easy but thanks in advance!