Load target scene after the loading screen and playing a transition effect.

This function is designed for you to be able to call it from Unity Events in the inspector, like the On Click call from UI Buttons. You can also call it from code.

Declaration

public void TransitionToScene(SceneReference targetScene);

public void TransitionToScene(string targetScene);

public void TransitionToScene(SceneReference targetScene, SceneTransitionEffect transitionEffect);

public void TransitionToScene(string targetScene, SceneTransitionEffect transitionEffect);

Parameters

targetScene SceneReferene object that holds a reference to the scene that will be loaded after the loading screen.
targetScene string Name of the scene to load after the loading screen.
transitionEffect Transition Effect that is played to change scenes. If not provided it will search for one in the scene.

using UnityEngine;
using UnityEngine.SceneManagement;

public class TransitionToSceneOnStart : MonoBehaviour
{
		public LoadingScreen loadingScreen;
		public SceneReference targetScene;
		public SceneTransitionEffect transitionEffect;

		void Start()
		{
				loadingScreen.**LoadScene**(targetScene, transitionEffect);
		}
}