Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
3
Question by Biendeo · Jun 12, 2010 at 08:50 PM · scenelevelfinishwarp

How do I finish a level and send the player to the next?

How do I finish a level and send the player to the next? I have been making a 2D platformer (following the tutorial on the website), but it never explains what to do if you want to get the player to the next level.

Should the next level be in a different scene, or should it warp the player somewhere else? Can someone give me tips for this? - This has been solved. I'm doing a different scene.

Also, what script can be used to move the player and respawn point from the finish object in the level to the next starting point of the next level? How do I use it? - I've figured that out. I just have to duplicate the objects there.

I've also got a fanfare I'd like to play at the end of the level. How can I add that in there as well?

Thanks if you can help!

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

3 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Biendeo · Jun 17, 2010 at 09:51 AM

karl wrote here: Move to next level on collide


Here's a completed script allowing you to set the next scene in the inspector. Make sure the plane/object you walk in to has "Is Trigger" marked. No rigidbody necessary.

//Script to revert winning player back to main menu

var levelToLoad : String;

function OnTriggerEnter(hit : Collider) { Application.LoadLevel(levelToLoad);

}//END FUNCTION ONTRIGGERENTER


This answers the question.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
4

Answer by JonManatee · Jun 12, 2010 at 09:03 PM

Putting your next level in a new scene can simplify the process of progressing to a new level and also help keep the performance of your game up by having less complicated scenes to deal with. However, it can make returning to a completed state in an old level more complicated.

The transition can be done with a Trigger Collider that has code similar to this (c#):

OnTriggerEnter(Collider other)
{
    if (other.tag == "Player")
        Application.LoadLevel("NameOfNextScene");
}

If you have information that you need to save between levels, consider placing it in static variables/classes, or having a GameObject that is set to gameObject.DontDestroyOnLoad() so it is not removed when the new scene is loaded

As far as player spawn position, simply place the player into the position they should start at in the editor for the new level (in much the same way as you did for your first level)

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Biendeo · Jun 14, 2010 at 08:38 AM 0
Share

I get what you're trying to do, but I don't understand what each command here does. Therefore, I keep getting an error because the Collider isn't working.

avatar image helphelphelpplz · Jun 14, 2010 at 08:45 AM 0
Share

Yeah, I get what you are saying Jon$$anonymous$$anatee. But what do you put in place of the word "other". The code isn't working for me.

avatar image Mike 3 · Jun 14, 2010 at 09:33 AM 0
Share

nothing - other is correct there. what's the error you're getting?

avatar image
1

Answer by helphelphelpplz · Jun 14, 2010 at 08:44 AM

Sorry, moved to comment section.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

End level when all enemies eliminated 2 Answers

Load a scene/level when enemy is close... 1 Answer

how to access objects in another scene but in the same project? 2 Answers

With multiple levels in my web game, how do I stream each scene so they download in the background as the user plays? 1 Answer

How do I load the first level? 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges