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 /
This question was closed Jan 09, 2020 at 01:21 PM by pako for the following reason:

The question is answered, right answer was accepted

avatar image
5
Question by nathanael_cassagnol · Dec 19, 2015 at 09:11 AM · scenescenes

Getting Scene index as int

Im trying to simply get the scene index as an int. With the new Unity.SceneManagment it should be easy but Im still experiencing problems.

I tried using Scene.BuildIndex but couldn't figure out how to get the index from the scene the script was in. And then I moved on to using SceneManagment.GetActiveScene and that has led to where I have the script attempt now which is

 SceneManagment.GetActiveScene = new int (y);
 int y = SceneManager.GetActiveScene();

although neither attempts are proving successful.

Is there any way to get the build index, as an int, from the current scene the.

Any help would be appreciated 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

1 Reply

  • Sort: 
avatar image
35
Best Answer

Answer by allenallenallen · Dec 19, 2015 at 09:13 AM

 int y = SceneManager.GetActiveScene().buildIndex;

SceneManager.GetActiveScene() returns a scene and bulidIndex returns that scene's build index.

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 Voker54 · Apr 30, 2017 at 04:09 PM 0
Share

Just wondering. What is the buildindex and how come it returns an int?

avatar image allenallenallen Voker54 · Apr 30, 2017 at 04:19 PM 1
Share

alt text The top right hand side shows the build indexes for each scene.

avatar image kosmas12 Voker54 · Jan 09, 2020 at 01:20 PM 1
Share

2 years later I am here to answer in text. The build index is more like the order in which your levels are. The first one is 0 and then it goes up. It is also the number Scene$$anonymous$$anager.LoadScene() uses to load a scene.

Follow this Question

Answers Answers and Comments

9 People are following this question.

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

Related Questions

Get how many frames have passed in the current scene? 0 Answers

Cannot close/unload a scene that is open in editor during playmode (using C# code)? 3 Answers

Unity 5.5b: SceneSet 0 Answers

Manually Edit EditoBuildSettings.asset 0 Answers

How to get the amount of scenes in a build? 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