Skip to content

Instantly share code, notes, and snippets.

@zaki
Created October 7, 2014 06:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zaki/6105d35fd4f64b5fd95c to your computer and use it in GitHub Desktop.
Save zaki/6105d35fd4f64b5fd95c to your computer and use it in GitHub Desktop.
Unity helper - Jump to title scene on start
using UnityEngine;
public class Startup : MonoBehaviour
{
private GameObject game = null;
[SerializeField]
private string startScene = "Title";
public void Awake()
{
game = GameObject.Find("Game");
if (game == null)
{
if (Application.loadedLevelName == startScene)
{
game = new GameObject("Game");
GameObject.DontDestroyOnLoad(game);
}
else
{
Application.LoadLevel(startScene);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment