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
0
Question by smasgames · Jun 12, 2011 at 07:28 PM · loadlevelcollideactivate

load level when no enemy car are left

I am making a car game were the player hits the cars and if all the cars die then it'll load a new level. I was thinking how about if all enemy cars die and a cube becomes activated so we then need to collide with it and a new level loads up. if you answer this question and it helps then ill give you a copy of the game for free.

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

Answer by FutchProductionsSyndicate · Jun 12, 2011 at 07:56 PM

Say there were five cars. Make a static variable thats 5. Then whenever a car dies subtract one from that number. When the number gets to zero you can have the scene fade to a loading screen and load the new level. Or you can make a object appear to send you to the next level in the same way.

The script to fade is here: http://www.unifycommunity.com/wiki/index.php?title=FadeInOut

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 smasgames · Jun 13, 2011 at 05:08 AM 0
Share

public var car : Transform;

function OnCollisionEnter(col: Collision){

 if(col.gameObject.name == "computer car moving"){
      Destroy(col.gameObject);
  }

}

is that correct FutchProductionsSyndicate?

avatar image FutchProductionsSyndicate · Jun 13, 2011 at 04:15 PM 0
Share

Yeah, that looks like it should work, but whats the public var doing there?

avatar image
0

Answer by sdsanft · Dec 23, 2014 at 04:43 AM

Create a script that triggers the next level to load when all the cars are destroyed. Create two variables for the number of cars and the number of cars destroyed and set the destroyed cars variable to zero. Every time a car is destroyed, increment that variable and when it is equal to the total number of cars (signifying all the cars are destroyed) load the next level using Application.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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

When player collides with object load next level 1 Answer

Android Button Text 1 Answer

How to reduce time of instantiating a prefab that contains many objects/components in it. 1 Answer

Restart game script. 1 Answer

Random level select 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