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 JoshMBeyer · Mar 22, 2014 at 04:13 AM · collisioncolliderdetectionnotworking

WTF is wrong! OnTrigger, OnCollision, nothing working!

So, all of a sudden in my project OnTrigger, OnCollision, Detect range, none of them would work. I tried copy pasting scripts, I tried following tutorials, I tried bare bone collision scene( Cube1[Has Collider set to IsTrigger, and Script] Cube2[Has collider, rigidbody, yes i tried even setting to is kinematic] moving Cube2 through Cube1, Regardless of what I try, Still nothing is working. I even went as far as re installing unity, deleting all my other projects off my computer, doing all updates for windows, restarting completely. Why wont anything work??

Here is the bare bone script for collision detection.

 using UnityEngine;
 using System.Collections;
 
 public class Test : MonoBehaviour {
 
     void OnTriggerEnter(Collider other)
     {
         Debug.Log("Shit be Working NOW??");
     }
 }
 
Comment
Add comment · Show 8
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 JoshMBeyer · Mar 22, 2014 at 04:14 AM 0
Share

I am tempted to reinstall windows completely.. even tho i realllyyyy dont want to do that. (Takes for ever with all the drivers and updates for my custom computer.)

avatar image getyour411 · Mar 22, 2014 at 04:23 AM 0
Share

Check your Edit / Project settings / Physics matrix, see if something got accidentally unchecked

avatar image taylank · Mar 22, 2014 at 04:24 AM 0
Share

Have you checked the collision matrix in Project Settings --> Physics?

avatar image thornekey · Mar 22, 2014 at 04:25 AM 0
Share

why would you reinstall windows.. unity is application software not system software.. it has nothing to do with it.. if you were going to reinstall anything it would be Unity, but regardless, i wouldnt do that anwyay..

avatar image robertbu · Mar 22, 2014 at 04:47 AM 0
Share

If you build a sample project with a sphere and a box, both colliders set to 'isTrigger' and have the script above. What happens if you put a rigidbody on the sphere and shoot it at the cube? Does it work in a totally new project/scene?

Show more comments

2 Replies

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

Answer by JoshMBeyer · Mar 22, 2014 at 10:48 AM

Ok, so After going through what no programmer should ever have to endure(You will not believe the thing's I've done in the past two days...) After reinstalling windows, unity, visual studio, etc. I made a new project, 1 cube, 1 sphere, OnCollisionEnter, Attached rigidbody to the sphere, pressed play, moved the sphere into the cube and holy vector3 it worked. the cube was destroyed. STILL have issue with onTriggerEnter, but I feel Mel Gibson in Braveheart, yes that part with the paint on his face.

Comment
Add comment · Show 3 · 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 JoshMBeyer · Mar 22, 2014 at 10:50 AM 0
Share

Ok OnTriggerEnter Is working. After reinstalling windows, and unity everything is going good so far. But I already tried reinstalling unity alone and that didnt work. Luckly enough things are in proper order now, I am going to sleep. "Posted at 5:49A$$anonymous$$"

avatar image Bunny83 · Mar 22, 2014 at 12:10 PM 0
Share

Are you sure you didn't used two $$anonymous$$eshCollider? $$anonymous$$eshCollider can't collide with each other unless at least one of them is set to convex. Another issue could be that you changed the layer / layer collision mask so they don't collide. Another reason could be that you might have scaled your object with a negative value.

Things almost never happen out of the sudden. You might have changed something (maybe by accident) and didn't know that it might cause problems.

I never ever have heard of or experienced myself a case where reinstalling Unity or even Windows has fixed anything. There is a small possibility that something got corrupted in the Unity installation but the chance that something went wrong in the OS and had that result on Unity is 1:20000000

avatar image JoshMBeyer · Mar 22, 2014 at 12:37 PM 0
Share

yes i am sure i was using a box collider and a sphere collider. BUT. I did try every other collider combination possible aswell. I mean it when i say i tried everything.

avatar image
0

Answer by RyanZimmerman87 · Mar 22, 2014 at 05:41 AM

What do you mean all the sudden it stopped working? Did you ever even have it working before in your current project?

So you said:

"( Cube1[Has Collider set to IsTrigger, and Script] Cube2[Has collider, rigidbody, yes i tried even setting to is kinematic] moving Cube2 through Cube1"

It looks like from your description you got the IsTrigger set on the wrong object. You should remove the is trigger from the stationary Cube1 and put it on the Moving Cube2.

Your moving trigger object needs to have a collider, rigidbody, and isTrigger enabled.

Sounds like you did everything right except you need to swap the triggers you have it backwards.

That way your cube 1 will receive the trigger collision in your script.

I'm not a documentation guru (actually really bad at studying) so hopefully I'm not mixed up here but I've always used the trigger object on the moving one, I'm pretty sure that's how it works.

But I think the script can be on either object. What's important is that only one of them is a trigger object and that's the one that is moving, has a collider, and rigid body.

Comment
Add comment · Show 6 · 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 JoshMBeyer · Mar 22, 2014 at 05:54 AM 0
Share

Yes I've tried that aswell. I mean I literally tried every possible combination. Nothing is working. Yes, I had Ontrigger, and Oncollision working already. Was working just fine. Then all of a sudden my player was reset completely to defaults, the fps_arms were scaled down dramaticly, my scripts folder(Including scripts) were deleted. I was testing the scene for a lasersight on the $$anonymous$$4 weapon. After i stoped the game, all that happened. Bullets stopped triggering since the scripts were deleted. I re scripted everything and then noticed none of the OnTrigger, OnCollision, Range Detection, none of them would register events. So I created a new project with just the cubes, and then with a cube and a sphere, tried every possible combiination of the requirements for the OnTrigger, etc. and still nothing.

avatar image JoshMBeyer · Mar 22, 2014 at 05:57 AM 0
Share

I've had similar problems with random resets of gameobjects and deleted asset. I have no idea why it happens but sometimes it does. this is why i figured i need to reinstall windows its self because idk i am just on my last limb here its been 2 days of this issue and trouble shooting something so simple to create(Refering to the cube and sphere collision detection) I even posted a video screen cast to show I am doing nothing wrong and everyone said yes it should definitely be triggering my debug.log but its not

avatar image JoshMBeyer · Mar 22, 2014 at 05:59 AM 0
Share

I mean I am willing to get on TeamViewer to let someone else try cause its seriously not because something I am doing wrong.

avatar image RyanZimmerman87 · Mar 22, 2014 at 06:54 AM 0
Share

Hmm that's very strange, not really sure what could cause that now.

Does a new project work? $$anonymous$$aybe some of your build settings got messed up?

Sounds very frustrating I hope you get it all sorted out. If it is just isolated to that project and not Unity itself you should be able to fix it if you find the right setting(s) that got messed up.

$$anonymous$$aybe you accidentally deleted some stuff or loaded up the wrong project file? I'm not sure how all that stuff would just disappear like that but certainly anything is possible with technology these days.

I would first try creating a new empty project with just 2 objects to see if it works.

If that works I would go back to your current project and check literally every single object and child component in the scene hierarchy list. You may just have one little unwanted script or mystery collider etc that's messing up everything.

Also you should always keep at the very least one but most likely several back up projects in case anything like this happens. And store it on a different hard drive just in case one dies.

avatar image JoshMBeyer · Mar 22, 2014 at 07:18 AM 0
Share

I did try a new project. I deleted all my projects off my computer, Uninstalled unity, reinstalled unity, created a new projects with 2 gameobjects, tested it and still did not work. I have no idea what is wrong. So... I did the unwanted and whiped out my computer, doing updates, hoping it will work now. If not, I am walking to the nearest gun store, getting a rocket launcher and shooting my computer.. twice..

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

26 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

Related Questions

Any idea why collision detection not working? [Video] 0 Answers

OnTriggerEnter not working 0 Answers

Check if an Instantiated object is colliding with another object right after being instantiated 1 Answer

how do i correctly use a box collider 1 Answer

Enemy Detection Area 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