Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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
2
Question by RandomDeveloper · Oct 23, 2014 at 01:14 AM · ontriggerenterbox collider

OnTriggerEnter not being called

Hey everyone,

I've been working on a project for a while now, but I hit a bump in the road on it recently. I have an empty object with a rigidbody, box collider and some code to detect if anything enters it's collider. However, even though tons of things are entering it, OnTriggerEnter is not being called. I experimented around a bit, and I found that changing it's rigidbody component in the inspector while the game is running would make OnTriggerEnter be called. So, I tried to replicate this in my code, by changing a few variables in my rigidbody component every frame. But it still wasn't called.

Is there something that I'm missing? (Please don't be one of those guys who just tells me to get Pro, not everyone can afford it)

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

4 Replies

· Add your reply
  • Sort: 
avatar image
5

Answer by guavaman · Oct 23, 2014 at 03:14 AM

Check out this page: Unity Manual - Colliders Scroll to the bottom and look at the two tables. They show you what combinations of collider, trigger, rigidbody, isKinematic will collide together. Next, make sure the objects are not on collision layers that are set to ignore each other.

Comment
Add comment · Show 8 · 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 freezurmom · Oct 26, 2015 at 04:42 PM 0
Share

You saved my life with ''Next, make sure the objects are not on collision layers that are set to ignore each other.''

Thanks dude :D

avatar image sethi-sahil27 freezurmom · Apr 09, 2016 at 07:31 PM 0
Share

how to check that?

avatar image sethi-sahil27 · Apr 09, 2016 at 07:31 PM 0
Share

how to check the collision layer part?

avatar image guavaman sethi-sahil27 · Apr 09, 2016 at 07:51 PM 0
Share

http://docs.unity3d.com/$$anonymous$$anual/LayerBasedCollision.html

avatar image sethi-sahil27 guavaman · Apr 09, 2016 at 07:55 PM 0
Share

thanks, but all of my GameObjects are under the same layer..the default later. could you guide me on how to rectify this?

Show more comments
Show more comments
avatar image Vito1316 · Apr 09, 2016 at 08:05 PM 0
Share

Thank you a lot. I've tried almost everything, the problem was that none of the colliders had rigidbody.

avatar image
3

Answer by lolioooz · Apr 23, 2017 at 07:49 AM

add rigid body to the object you wanted to be collide

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
2

Answer by wyckster · Dec 06, 2020 at 11:52 PM

In a 2D game it's called OnTriggerEnter2D. (...in case anyone arrives here but is using Collider2D and RigidBody2D).

Tragically, there is no complaint if you if you define OnTriggerEnter on your 2D object. It just never gets called.

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
0

Answer by DarthHawk13 · Jan 07, 2017 at 09:51 PM

This you tube tutorial by Brackeys may help : https://www.youtube.com/watch?v=STzGxHbdwgw

Also I got frustrated for about an hour earlier today asking myself the same question, Why won't collisions work anymore? Come to find out I hadn't attached the script I wrote to the gameobject... haha.

You may or may not need to mess around with collision layers. For the small demo game I'm currently making for my portfolio all my game objects are on the default layer.

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

35 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 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

[SOLVED] OnTriggerExit only called when object moves 0 Answers

OnTriggerEnter strange bug 2 Answers

Mesh Collider Won't Work After Running Another Collider 2 Answers

How to use different and distinguish between different box colliders? 1 Answer

How do i delete a gameObject if it enters a box collider using tags 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