Advertisement
LeeMace

Simple Next Scene Loader

May 23rd, 2023 (edited)
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.55 KB | Gaming | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.SceneManagement;
  5.  
  6. public class SceneLoader : MonoBehaviour
  7. { //simple scene loading function to load the next scene in hte build
  8.   public void LoadNextScene() {
  9.  
  10.         int currentSceneIndex = SceneManager.GetActiveScene().buildIndex;
  11.         SceneManager.LoadScene(currentSceneIndex+1);
  12.     }
  13. //enable this one on the play again button to take you back to the start menu
  14.  public void LoadStartScene() {
  15.         SceneManager.LoadScene(0);
  16.     }
  17. }
Tags: Scene loader
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement