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 /
avatar image
1
Question by Damo1175 · Dec 05, 2016 at 07:32 AM · editorsceneloadingsplash

Not loading scene on build

Hi, I've got a script that shows a splash screen for a certain amount of time, then takes me to a new scene. Only problem is, it works very good inside the editor. Although when I build the game, and run it by the .exe file, it does nothing.

 using UnityEngine;
 using System.Collections;
 
 public class splashscreen1 : MonoBehaviour {
     [Header ("Object Type")]
     public int timer;
     public Object nextScene;
 
 
     // Use this for initialization
     void Start () {
 
         StartCoroutine (loadSceneAfterDelay(timer));
 
     }
 
     IEnumerator loadSceneAfterDelay(float waitbySecs){
 
         yield return new WaitForSeconds(waitbySecs);
         Application.LoadLevel(nextScene.name);
     } 
 }
 

What am I doing wrong?

Comment
Add comment · Show 5
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 christoph_r · Dec 05, 2016 at 09:30 AM 0
Share

Are you making sure to include the scene you want to load when building?

avatar image Damo1175 · Dec 05, 2016 at 10:30 AM 0
Share

Yes the scene is included when building. If its not it usually throws an error at me inside the editor. If I remove the splash screens, and put the scene that I'm trying to get them to go to, it works. But I want the splash screens there.

avatar image christoph_r · Dec 05, 2016 at 10:59 AM 0
Share

And there are no errors/warnings when debugging the build? Have you tried logging if the coroutine gets called and if it finishes?

avatar image Damo1175 christoph_r · Dec 05, 2016 at 11:07 AM 0
Share

When debugging, theres no error or warnings at all. Works perfectly fine. Just when running the .exe, it fails to work

avatar image christoph_r Damo1175 · Dec 06, 2016 at 09:50 AM 0
Share

Have you checked the log generated by the build?

1 Reply

· Add your reply
  • Sort: 
avatar image
2

Answer by Paricus · Dec 06, 2016 at 10:16 AM

Unity has switched to SceneManager to handle its scenes. you should find what you need here: https://docs.unity3d.com/ScriptReference/SceneManagement.SceneManager.html

Application.LoadLevel() is deprecated

Comment
Add comment · Show 8 · 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 Damo1175 · Dec 06, 2016 at 10:39 AM 0
Share

I did Scene$$anonymous$$anager.LoadScene (nextScene.name); Still same result. Will work in editor. Won't work in build

avatar image Paricus · Dec 06, 2016 at 12:02 PM 0
Share

Try a development build, the log should show you any errors

avatar image Damo1175 Paricus · Dec 06, 2016 at 12:13 PM 0
Share

alt text

Thank you for your reply. I received this error. Which ponits to the line: Scene$$anonymous$$anager.LoadScene (nextScene.name);

error.png (43.8 kB)
avatar image Paricus · Dec 06, 2016 at 12:23 PM 0
Share

Try Scene$$anonymous$$anager.LoadScene (0);

If that works. It's an issue with nextScenes. name

avatar image Damo1175 Paricus · Dec 06, 2016 at 12:30 PM 0
Share

This does indeed work. Would you have any idea what would be wrong with nextScenes.name? Or is there any better way that I could go about doing this? alt text

error.png (17.1 kB)
avatar image Paricus Damo1175 · Dec 06, 2016 at 12:37 PM 0
Share

I'm not familiar with next scene.name

Is it your own code.

Show more comments

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Camera.main.pixel incorrectly return scene view's size in OnDrawGizmos 0 Answers

LoadSceneMode.Single seems to be not working. 0 Answers

Determine the Scene that is selected when using context menu 0 Answers

Editor Scene? 1 Answer

Scene Box/Rectangle Editor. Does one exist? 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