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 jokim · Sep 12, 2014 at 07:21 PM · c#sceneassetbundleloadlevel

Scene Asset Bundle - LoadLevelAdditive and OnLevelWasLoaded

This question has 2 parts.

First :

Is there a way to get the index of a scene loaded from an assetBundle ? At runtime ?

Second :

Is the function OnLevelWasLoaded called when you use the LoadLevelAdditive ?

Now, the reason I want to know this is because i'm using a script which deals with scene changes, it also handles showing and hiding the loading screen when needed. As of now, I was just calling the "Show" method (for the loading screen) before loading a scene, and then, in that scene, I had a script that would "Hide" it from the Start. Let's face it, this isn't... well encapsulated. And it's kind of a pain to need a script in each scene to call the loading screen off.

I recently discovered the OnLevelWasLoaded method, which would actually achieve what I want. Problem is, some of these scenes are bundled. (Not in the project settings), and I have no way of telling which index they are. Hence the First question.

After thinking for a bit, I thought "Well, I don't actually need to know which scene is loaded, I just need to dismiss the screen when a scene is loaded, Any".... well, ends up that's not exactly true. There's some scenes I am loading additively (is that a word ?) And I don't necessarily want the "Hide" function to be called at those times - Well, sure, right now it's not doing much, but it might eventually do. Hence the Second question

If it's not fired, then I could work with this workaround.

Thank you for your time, hope I was clear enough.


EDIT:

I just thought about something, Is it possible to get the name instead of the index ? and then get the index with the name ?


EDIT 2 :

I found part of an answer to that last question Here

Says you can Check names with assetBundle.contains, but not really get the name without knowing it first.

Comment
Add comment · Show 1
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 jokim · Sep 16, 2014 at 02:05 PM 0
Share

I've been looking for an answer to this with no success. I can't find anything about finding index of a scene, and i can't find anything saying you can't get it either... Am I the only one who sees some utility in this ?

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by niall1111 · Sep 17, 2014 at 07:57 PM

This is what you're looking for. :)

http://docs.unity3d.com/ScriptReference/Application-loadedLevelName.html

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 jokim · Sep 18, 2014 at 02:15 PM 0
Share

This definitely adds to the possibilities. Is there a way to find the index of a scene with a name ?

EDIT : Turns out it's simpler than that : http://docs.unity3d.com/ScriptReference/Application-loadedLevel.html

They both basically do the same, returning a different value type. Thanks for the pointer niall.

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

24 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

Related Questions

Application.LoadLevel Strange Problem 2 Answers

Can a script be loaded to a next scene? 3 Answers

Load Scene in AssetBundle and Unload 4 Answers

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 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