- Home /
Load Scene
Hi! I use this code to load the second scene, but not work. In firts scene there is a simple presentation video, in the second scene the main menu, but this script load only the firts scene, and when the video of the firts scene is finished, it stops, and don't load the second scene (Main menu)
All two scenes are in the "Scene in Build"..
This script is attached at the firts scene. Hope you help me :/
using UnityEngine;
using System.Collections;
public class CaricaScene : MonoBehaviour {
public bool VideoStart = true;
public bool Menu = false;
void Start()
{
VideoStart = true;
Menu = false;
Screen.showCursor = false;
}
void Update ()
{
MethodBase opzioni = opzioni.GetCurrentMethod();
Menu = true;
VideoStart = false;
}
void opzioni (int id)
{
if (VideoStart)
{
Application.LoadLevel("AidaGames");
}
if (Menu)
{
Application.LoadLevel("MainMenu");
}
}
Close your old question as this is a duplicate really. http://answers.unity3d.com/questions/522286/problem-loadlevel.html
$$anonymous$$y comment in last post:
You dont call opzioni(int id) and if you did, what is the int for?
Also as $$anonymous$$enu = true; VideoStart = false; is hardcoded to the Update() function any attempt to change these values elsewhere would be overridden by Update()
You have added some kind of call but I really feel you are over-complicating a very simple thing.
In your first scene make a gameObject with a script that handles the condition for the second scene load.
if(condition == true)
{
Application.LoadLevel("AidaGames");
}
As its a main menu I'm assu$$anonymous$$g you have some kind of Start button. The LoadLevel should occur when you have pressed the Start button.
I use Android so in my touch handler if the GUIText "Start" is touched -> Application.LoadLevel
Hmh I have to create an empty game object in firts scene, ok.. but I don't understand which script to put... sorry but Im' beginner with script.. :/ what should I put in place of "condition"?
I think first you have to decide on what you want to happen/ what you need to do to trigger the load.
Do you press a button? Is it automatic after a time period?
After a time period.. when the firts video is finished (during 4,5 seconds) afrter this, start the second scene.
Answer by Fabian0010 · Aug 23, 2013 at 04:42 PM
Go to build settings and add scenes. then use the numbers: Application.LoadLevel("1"); Application.LoadLevel("2"); Application.LoadLevel("...");
Your answer
Follow this Question
Related Questions
How the scene works 1 Answer
Multiple Instances of My Current Scene? 0 Answers
Current scene number 2 Answers
How can I save the player's progress in-game? 1 Answer
What is the Difference betwwen a "Level" and a "scene" 2 Answers