- Home /
Next Level (Loadlevel)
Can anyone help me.I need script for next level when i click some object with FPC to go to next level. Sorry for bed English and tnx.
Answer by numberkruncher · Feb 01, 2013 at 02:09 PM
You can load the next level using the following:
Application.LoadLevel(Application.loadedLevel + 1);
Obviously you will need to perform bounds checking on the level index, but this is the general idea.
See: http://docs.unity3d.com/Documentation/ScriptReference/Application.LoadLevel.html
Iam beginner but i know how use Application.LoadLevel but i don
t know how to make script when i click on some object-(Cube) to go to next level.
Something like this
if(click object)
Application.LoadLevel("Next Level")
I tried this but when i click "space" from any place i go to next level.I want to make when you find object{Cube) and when you click "space" you go to Next Level.
function Update () {
if (Input.Get$$anonymous$$ey ("space")) {
Application.LoadLevel("Next Level");
}
}
Answer by Mmmpies · Aug 31, 2014 at 07:36 PM
You could try this:
private void OnMouseDown() { Application.LoadLevel("Whatever level you want to load"); }
and attach the script to the object (drag and drop the script onto the GameObject).
Really though go on youtube and search out some tutorials, try the burgzerg tutorials for example as they talk you through a lot of different scripting and unity scenarios. There are lots of other tutorials out there as well, one of the major advantages to unity is the community.
You're also going to have to pick which programming language you're going to use. Personally I'd learn c# if you're starting out as it's faster, it's a bit more fussy though so for a noob (and not too long ago I was that noob) it can be harder. Still it's faster, and if you've got to learn it from scratch then why not go for the fastest.
Answer by Eco-Editor · May 17, 2017 at 10:24 AM
I know this is an old post, but I have a strange thing happening. When I load next level using:
void Update()
{
if (Controller.GetHairTriggerDown())
{
if (collidingObject) //I added the item to the conditional
{
Application.LoadLevel (Application.loadedLevel + 1);
Because I use Htc Vive instead of the Mouse Click,. This only works from my first scene, and it doesn't let me go through scenes in chronological order, but if I use scene name:
Application.LoadLevel ("Floor2");
It will send me to any scene I want.
Any ideal why this is happening?
I see my problem now. As I'm using unity 5 I should use this:
{ if (Controller.GetHairTriggerDown()) { if (collidingObject) {void Update()
Scene$$anonymous$$anager.LoadScene("0", LoadScene$$anonymous$$ode.Single); But, how do I add a new scene in chronological order? Something like Application.loadedLevel + 1?
I've solved it!
Apparently didn't add the scene loaded script in the other scenes.
Your answer
Follow this Question
Related Questions
Load Level when i click on some object 2 Answers
Load Level on Collision 1 Answer
Next LEVEL Load Problem. 2 Answers
Collision To Next Level Is Not Working 1 Answer
Unity crash, no one is call the function but it show up to the party anyways 0 Answers