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 iRaMb0 · Jan 16, 2013 at 04:28 PM · loadleveldelayadditive

LoadLevelAdditive delay

Hi, i have a loading scene with every object in the scene parented to ONE empty game object and a script attached to it.

 function Update(){
 
 
 
 
 
 
 
 
 Application.LoadLevelAdditive("Game2");
 
 
 
 
 Destroy(this.gameObject);
 
 
 
 
 
     
     
     }
     
     
     
     
     So basically this script loads the scene "Game2" but it changes scenes so fast that you cant even see the loading screen...so i want a delay before the script changes scene, is there a way to do it? ( i tried using waitforseconds but that didnt work cause it will just stay at the loading scene)
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

2 Replies

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

Answer by iRaMb0 · Jan 20, 2013 at 08:17 AM

Wow i actually fixed it :) Instead of function Update i had to use function Start ( as Geo.Ego said) and use a different function for the loading part :

 function Start(){
 yield WaitForSeconds(3);
 
 Load();
     
     }
     
     
     
     
     
     
     
     
 function Load(){
 
 Application.LoadLevelAdditive("Game2");
 
 Destroy(this.gameObject);
 
     
 
 }
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 Geo.Ego · Jan 16, 2013 at 04:50 PM

A few things: if you're going to use yield WaitForSeconds, you need to use it an IEnumerator block that is called by StartCoroutine. Also, since this is only going to happen once, you'd probably want to put it in Start instead of your Update function. Try this:

 private IEnumerator LoadNextScene ()
 {
    yield return new WaitForSeconds (5.0f); // Change this float to the number of seconds to delay for.
    Application.LoadLevelAdditive("Game2");
 }
 
 void Start ()
 {
     StartCoroutine (LoadNextScene ());
 }
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 iRaMb0 · Jan 18, 2013 at 04:47 PM 0
Share

is this a C# script?It obviously isn't java so i tried it in C# and i got this error : (10,6): error CS0116: A namespace can only contain types and namespace declarations

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

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

Load level / prefabs without causing hiccups 1 Answer

Load Level Additive Async Lag spike 0 Answers

Better way for a timer to load a level? 1 Answer

allowSceneActivation give me error message 0 Answers

load level when no enemy car are left 2 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