basic scene advance by space bar

Hi all,

Quite a basic question, but every guide I am reading is a bit more complicated than what I need or is using the old unity scripting bits that have now changed to scene.manager.

I have “scene 1 test” and “scene 2 test” .

I would like to hit space bar and have the scene go from “scene 1 test” to “scene 2 test”.

this is what I have so far, excuse the naiveness, I am trying to learn all of this in a compressed timeline:

using UnityEngine;
using System.Collections;
using UnityEngine.SceneManagement;

public class SceneFades : MonoBehaviour {

void Start () {

}

void Update () {

	if (Input.GetKeyDown (KeyCode.Space))

		SceneManager.LoadScene ("scene 1 test");

	}
}

Moving forward from there, I am ultimately making a slide show of scenes essentially, that I want to play back along with a sound track. I want to be able to hit space bar, have the sound track start and then play each scene and their animation play and automatically advanced as they finish.

Any advice would be greatly appreciated.

Thank you!!

public class SceneFades : MonoBehaviour {

	public string nextSceneToLoad;
	public float timeLength = 10f; //seconds
	private float elapsedTime = 0f; 
	
	void Update () {
		if (Input.GetKeyDown (KeyCode.Space))
			SceneManager.LoadScene(nextSceneToLoad);

		elapsedTime += Time.deltaTime;
		if (elapsedTime > timeLength)
			SceneManager.LoadScene(nextSceneToLoad);
	}
}

You can re-use the script for every scene.

For audio, add an AudioSource to a GameObject, drop in a sound file to where it says AudioClip. Make sure Play on Awake is checked.

Animations can play on awake as well.