Skip to content

Instantly share code, notes, and snippets.

@sabotai
Last active May 19, 2024 12:01
Show Gist options
  • Save sabotai/7768d154c4a4446fb7fdbaaa971d176f to your computer and use it in GitHub Desktop.
Save sabotai/7768d154c4a4446fb7fdbaaa971d176f to your computer and use it in GitHub Desktop.
Easy Trigger Scene Load Unity
using UnityEngine;
using System.Collections;
using UnityEngine.SceneManagement;
//HOW TO USE::
//make a new "C# Script" in the project tab and give it the name "SceneLoad"
//open up the new script and paste the entire contents
//attach the new script to your player object
//Create a new GameObject, adding one of the Collider2D components
//check the "is trigger" box for the collider settings
public class SceneLoad : MonoBehaviour {
void OnTriggerEnter2D(Collider2D other) {
Debug.Log ("GOGOGOGO SCENE");
SceneManager.LoadScene("SCENENAME"); //load this scene... change SCENENAME to the name of the scene you want
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment