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
-1
Question by repaj · Feb 28, 2014 at 06:46 PM · collisionwater

Why won't it end game on unity on contact with water

Here is my code #pragma strict

function OnTriggerEnter () { Application.Quit(); }

function OnCollisionEnter(other : Collision) { Application.Quit(); }

This is a script I made under the object water.

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 perchik · Feb 28, 2014 at 06:46 PM 0
Share

Have you tried adding Debug.Log statements into the those functions to see if the application actually gets there?

avatar image repaj · Feb 28, 2014 at 06:54 PM 0
Share

It seems to never get there, how could I fix this?

avatar image Kiloblargh · Feb 28, 2014 at 08:14 PM 0
Share

I have to ask; why are you trying to do this? No real game would quit on entering a collision, and you're not the first or even the fifth one asking how to do that.

avatar image repaj · Feb 28, 2014 at 08:15 PM 0
Share

i've changed it to restart on collision, so that when(the car) hits the water the game automatically restarts

avatar image repaj · Feb 28, 2014 at 08:40 PM 0
Share

PS. is there a way to replace my currently painted trees(on terrain) with a different tree but retain there position?

1 Reply

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

Answer by chris_taylor · Feb 28, 2014 at 06:50 PM

Make sure you have a collider and rigidBody on the object, also I suggest checking the tag to make sure you are hitting water

also I dont think Application.Quit does anything inside the editor

Comment
Add comment · Show 10 · 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 repaj · Feb 28, 2014 at 06:56 PM 0
Share

I've added a rigid body but which collider should I use- terrain?

avatar image repaj · Feb 28, 2014 at 06:57 PM 0
Share

the tag? .

avatar image chris_taylor · Feb 28, 2014 at 07:10 PM 0
Share

Tags

This message is sent to the trigger collider and the rigidbody (or the collider if there is no rigidbody) that touches the trigger. Note that trigger events are only sent if one of the colliders also has a rigid body attached.

referance

avatar image repaj · Feb 28, 2014 at 07:17 PM 0
Share

what collider should I use-terrain?

avatar image chris_taylor · Feb 28, 2014 at 07:23 PM 0
Share

If you are just using the built in unity water then add a box collider and scale it to the size and depth of the water and mark it as trigger

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

22 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Collision with specific object... 2 Answers

How do I get my water to work?,How do I slow my descent in water? 0 Answers

Collider Don't work 1 Answer

How do I make a boat that doesn't let water enter?,How do I make a boat that water cant get in to 2 Answers

Collision is glitchy 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