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 Colombian.kiwi · Apr 25, 2011 at 04:12 AM · colliderscutscenelose

lose and win game

hello everyone! I would like to load a scene when my main character reaches the end of the game to let the player know he has won, and would like to do the same when he loses ( when he collides with a particular object) any ideas? ... thanks a lot!

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

3 Replies

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

Answer by MC HALO · Apr 25, 2011 at 04:33 AM

function OnCollisionEnter (Hit: Collision){

 if(Hit.gameObject.tag == " Put your objects tag here"){

  Application.loadLevel(" Put you level name here ");  

} }

first thing is first you have to tag your player as "Player" then assign the tag to him. then copy the script add the tag as "Player" and then the level to load name and then save the script and attach it to the object that the player will collide with in order to bring up the win stage :)

Comment
Add comment · Show 4 · 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 Colombian.kiwi · Apr 25, 2011 at 04:54 AM 0
Share

its says: unknown identifier: "hit"... ? :(

avatar image MC HALO · Apr 25, 2011 at 04:55 AM 0
Share

Ops sorry i will update the answer lol

avatar image Colombian.kiwi · Apr 25, 2011 at 04:57 AM 0
Share

its alright i fixed it! :P thanks a lot!!

avatar image MC HALO · Apr 25, 2011 at 04:58 AM 0
Share

Your welcome :)

avatar image
3

Answer by crazyKnight · Apr 25, 2011 at 04:31 AM

function OnCollisionEnter(collision : Collision) { Application.loadLevel("name of the level to be loaded"); }

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
1

Answer by by0log1c · Apr 25, 2011 at 04:21 AM

If the question is "How do I load a scene?" , then you must add the scenes to the File > Build Settings list and then use:

Application.loadLevel(0);          //use scene index
Application.loadLevel("GameOver"); //use scene name 
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 Colombian.kiwi · Apr 25, 2011 at 04:29 AM 0
Share

yeah.. Ive done that already, I dont know how to load the scenes when he wins or loses... :S

avatar image by0log1c · Apr 25, 2011 at 04:32 AM 0
Share

my mistake, crazy$$anonymous$$night's answer is probably correct. Just make sure the collider you hit is the one initiating the game-over process.

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

No one has followed this question yet.

Related Questions

physics.OverlapSphere colliders 1 Answer

How Can You Add Cut Scenes In Unity 2 Answers

I want to put an animated gif/avi sequence for a title screen. 1 Answer

getting a object to slowly orbit 2 Answers

Is there any way to change a scene while Handheld.PlayFullScreenMovie is playing a movie? 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