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 Dr_GeoFry · Apr 17, 2012 at 11:59 PM · androidcollidersloadlevel

Can not get Level to Load using level collider

Hi,

I am trying to use a collider to initiate a level change, but I am having no luck and I don't know why. Here is my script:

 function OnTriggerEnter(other:Collider){
     if(other.gameObject.tag=="NextLevel"){
        Application.LoadLevel("level2");
     }
 }

Also, if you can help me, I wanted to initiate new levels with some sort of delay, and came up with this, and wondered if I could just add part of this script to the collider script.

 private var myTimeout:float;

 function Start()
 {
     myTimeout = Time.time+30; // 30 second delay
 } 

 function Update()
 {
     if(Time.time > myTimeout)
     {
         Application.LoadLevel("level2");
     }
 }

Thank you for helping me.

Comment
Add comment · Show 2
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 syclamoth · Apr 18, 2012 at 12:08 AM 0
Share

I hate to nitpick, but fixing people's post formatting gets a bit old after a while.

avatar image Dr_GeoFry · Apr 18, 2012 at 12:12 AM 0
Share

I apologize. Sorry for my noobishness.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by syclamoth · Apr 18, 2012 at 12:11 AM

For the first part, make sure you have at least one rigibody in the interaction, so that physics gets activated. This kind of thing is like the second-most asked question, so look around this site and I'm sure you'll find a few (hundered) answers to your problem.

As for the second part, the easiest way to do that would be like this:

 function DelayedLevelLoad(waitTime : float)
 {
     yield WaitForSeconds(waitTime);
     Application.LoadLevel("level2");
 }

Then, just call that function from anywhwere with a number for the amount of time, and you're good!

 DelayedLevelLoad(30); // loads the level after 30 seconds
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 Dr_GeoFry · Apr 18, 2012 at 02:44 AM 1
Share

I did everything the right way, I just never added the second level to the build... Sometimes it's the little things.

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

Two colliders on GameObject with only one acting as trigger 2 Answers

collisions not detected 1 Answer

Application.LoadLevel causes crash on Android. 2 Answers

Android: Scene change (Application.LoadLevel) has no effect 3 Answers

Android: lost textures with Home button/background? 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