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 RuFrozen · Aug 23, 2012 at 03:55 PM · sceneloadingresources

Manual loading scene inside editor

For loading scene inside editor I use this function:

 Resources.LoadAssetAtPath("Assets/Scenes/myscene.unity", typeof(Object));

It returns me instance of UnityEngine.DefaultAsset

Then I try load "myscene" using this function:

 Application.LoadLevel("myscene");

But it says that Level 'myscene' (-1) couldn't be loaded because it has not been added to the build settings.

I don't want to add it to build settings, because in web player I load it using bundles. And inside editor I want to load it directly. How can I do it?

Comment
Add comment · Show 3
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 Khada · Aug 23, 2012 at 05:00 PM 0
Share

Why do you need a script to change scene in the editor? Just double click a scene and it will load.

avatar image ScroodgeM · Aug 23, 2012 at 06:59 PM 0
Share

@$$anonymous$$hada, this can be needed for some batch operations for example.

avatar image RuFrozen · Aug 23, 2012 at 08:12 PM 0
Share

I want to make code that will have different behavior in editor and in web player. In Web player I loaded scenes from bundles, in editor I want loaded it directly. But if I add scene to build settings, and I can't make build, because unity include that scene in unity3d files. So I always need to add and to remove scenes from build settings, that was problem.

4 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by raimon.massanet · May 14, 2013 at 12:57 PM

I think you are looking for this:

http://docs.unity3d.com/Documentation/ScriptReference/EditorApplication.OpenScene.html

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 ScroodgeM · Aug 23, 2012 at 06:57 PM

here

edit

create a simple 'if' block with this check and load scene directly or using bundle. you can't write in one line a code that will load asset bundle packed scene in unity web player or directly using editor's methods if you are in editor.

also you can use #IF blocks to exclude editor-loading lines from web player build

Comment
Add comment · Show 2 · 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 RuFrozen · Aug 23, 2012 at 08:17 PM 0
Share

Thank you, but I need to make it in editor play mode and using in game script. As I wrote in post above. I need the same behavior in editor play mode as in web player mode.

avatar image ScroodgeM · Aug 23, 2012 at 08:33 PM 0
Share

check answer again

avatar image
0

Answer by Mander · Aug 23, 2012 at 07:57 PM

with ur scene open. go to Files->BuildSettings then clic the Add Current button. and u r set to go

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 RuFrozen · Aug 23, 2012 at 08:03 PM 1
Share

I don't want to add it to build settings, because in web player I load it using bundles. And inside editor I want to load it directly.

avatar image
0

Answer by GaoshanBaiyun · Aug 10, 2018 at 06:20 AM

EditorApplication.LoadLevel

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

13 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

Related Questions

heavy scene loading 1 Answer

Building single scene is much too large! 0 Answers

pre-load multiple scenes but only activate one 0 Answers

Addressable for Oculus Go 2 Answers

How to determine which resources are loaded while loading scene 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