Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
  • Help Room /
avatar image
0
Question by kevinrocks_786 · Dec 09, 2015 at 04:35 AM · unity5applicationapplication.loadlevelapplication.loadedlevel

Unity 5.3 Restarting current scene

Hello, before Unity 5.3, I could do

  Application.LoadLevel(Application.loadedLevel);

But now it's something weird with SceneManager. I've read documentation but nothing. How do I get the current scene and load it (Unity 5.3f4)?

Thanks!

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

4 Replies

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

Answer by jbecana · Dec 09, 2015 at 10:26 AM

I haven't tried yet, but it should be something like this:

     Scene loadedLevel = SceneManager.GetActiveScene ();
     SceneManager.LoadScene (loadedLevel.buildIndex);
Comment
Add comment · Show 1 · 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 kevinrocks_786 · Dec 09, 2015 at 12:16 PM 0
Share

Thanks it helped, but when it resets the scene, the shading is much darker. However I doubt that will actually happen in the actual build. Thanks.

avatar image
1

Answer by GarthLaoshi · Apr 08, 2017 at 08:15 AM

As Kermitt said, but just in one line:

 SceneManager.LoadSceneAsync(SceneManager.GetActiveScene().buildIndex);

Tested this on the survival shooter tutorial (the current tutorial uses the obsolete loadlevel code).

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
0

Answer by kevinrocks_786 · Dec 09, 2015 at 12:15 PM

@kermitt Thanks it helped, but when it resets the scene, the shading is much darker. However I doubt that will actually happen in the actual build. Thanks.

Comment
Add comment · Show 4 · 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 swagmanPT · Sep 20, 2016 at 03:25 PM 0
Share

@kevinrocks_786 what libraries are you importing on the script? $$anonymous$$e doesn't recognize "Scene"

avatar image kevinrocks_786 swagmanPT · Sep 20, 2016 at 09:34 PM 0
Share

UnityEngine.Scene$$anonymous$$anagement is the namespace. Scene$$anonymous$$anager is the class.

avatar image swagmanPT kevinrocks_786 · Sep 20, 2016 at 09:45 PM 0
Share

Thanks @kevinrocks_786

avatar image dway97 · Jul 08, 2018 at 07:51 PM 1
Share

Scenes become darker when reloaded or even if you switch to another within the editor due to a glitch with the Auto Generate Lighting feature. Disable it in your scene's lighting settings and you should be good to go :)

avatar image
0

Answer by bekjan_ · Jun 03, 2017 at 11:34 AM

kevinrocks_786 I just have quick question about the shading, is it going to be a problem? I have a similar problem, the scene restarts but shaders go dark, and in my case its really visible and looks bad.

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

41 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Teleport to next scene 0 Answers

Arduino to Unity 0 Answers

IndexOutOfRangeException: tanks index is invalid , i was trying to add new Tank in Tanks!!! game but get this error 1 Answer

how to change default image of display dialogue box in unity c#? 0 Answers

4 unity Button click detect different targets 0 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