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
0
Question by Barft · Jun 26, 2015 at 02:02 PM · c#level

Open a new level when you finished the current level

Hi all, I have a problem..

I have made a game with 30 levels, now you can just load every scene and play it via a scene with alot of buttons that open the levels, but that is not what I want. I want to make it so that you first finish for example level 1, and than you can play level 2. And also a thing that is important, that when you leave the game and you launch the game later, that you not playing all the levels again, that you can play for example level 5, if you was there.

I program with c#

I hope it's clean, but my english is not the best :(

(Btw, i'm not a pro with unity of c#, i use unity now for 5 months. So i hope you guys can help my.)

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Landern · Jun 26, 2015 at 02:10 PM

First off this isn't a service, you will have to do the leg work here. So have some things to look into...

You can save whatever settings you want by using the PlayerPrefs, you can store and (Save) values to persist through out the execution of your game.

For levels, you might start with ensuring that you're using some naming convention so you can use just one script to load a level.

Lets say you're level naming scheme is something like this: "level_##.scene" and that is what you load into the build settings.

that would leave you having a list like:

  • Level_1.scene

  • Level_2.scene

  • Level_3.scene

  • ...

  • Level_10.scene

You can then use the combination of the current level and a script with custom methods that build out the next seen to load:

 public void LoadNextLevel(int levelIndex)
 {
      // string.Format takes the params after the string
      Application.LoadLevel("Level_" + levelIndex.ToString());
 }

What you do to call the LoadNextLevel method is up to you as well as the placement.

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

2 People are following this question.

avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

How to execute a Skript global? 2 Answers

Multiple Instances of My Current Scene? 0 Answers

How can I end a level and go to the next level 1 Answer


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