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 laszlar · Jun 02, 2016 at 02:51 AM · collision detectioncollision2dontriggerenter2dupdate problem

Two Different Box Colliders Aren't Colliding

I've taken a little break from a project, but have recently updated to Unity 5.3.5 from 5.3.3 (Interestingly It had some kind of warning about updating - I can't remember what it was specifically).

Onto the problem, I created an empty game object with a box collider2D and put a script on it to destroy game objects. This works beautifully on all colliders that have been in the project before the update, but when I create a new object with a box collider2D on it - it doesn't collide at all! It doesn't even recognize that it's colliding. Yes I have checked the collision matrix as well, and it's working as expected.

Here is the destroyer collider's script (that destroys the out of bound objects):

 using UnityEngine;
 using UnityEngine.SceneManagement;
 using System.Collections;
 
 public class Destroyer : MonoBehaviour
 {
     int deathTime = 1;
 
     void OnTriggerEnter2D(Collider2D collision)
     {
         if (collision.gameObject.tag == "Player")
         {
             StartCoroutine(DeathAfterSec(deathTime));
         }
 
         Destroy(collision.gameObject);
 
         if(collision.gameObject.tag == "Untagged")
         {
             Debug.Log("planksucks");
         }
     }
 
     IEnumerator DeathAfterSec (int deathTime)
     {
         yield return new WaitForSeconds(deathTime);
         SceneManager.LoadScene("Scene2");
     }
 }

Yes - I am trying to destroy the object named Plank ;p

Comment
Add comment · Show 2
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 laszlar · Jun 02, 2016 at 03:17 AM 0
Share

This is the message I get upon trying to open project alt text

unitymesssage.png (129.4 kB)
avatar image laszlar · Jun 02, 2016 at 03:18 AM 0
Share

And no, I didn't create this project before Unity 5.

1 Reply

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

Answer by laszlar · Jun 02, 2016 at 04:02 AM

I found the answer from another question that was slightly different. It's a Unity bug, and the solution is to add a rigidbody2d to the object your trying to destroy and enable kinematic.

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 allenallenallen · Jun 02, 2016 at 08:53 AM 0
Share

For those interested: http://forum.unity3d.com/threads/unity-2d-trigger-box-colliders-not-working-on-5-3.372615/

I'm not sure if the "bug" is fixed yet (or reappeared in recent versions). But the main idea is to NEVER move a static object.

avatar image laszlar · Jun 03, 2016 at 06:14 PM 0
Share

@allenallenallen ugghh I'm pretty sure I sound like a noob, but static object? The original box collider is static, and doesn't move. The second object co$$anonymous$$g towards it is a box collider, the first object (static) sits there and when second object comes up to it, the first object destroys the second object.

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

43 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Collision detection problem 0 Answers

Object passes through collider even when isTrigger is turned off. 2 Answers

Having problems with obstacle collision killing the player 1 Answer

OnCollisionExit2D workaround? 0 Answers

How do I set an object's velocity to the velocity of an object that collided with it? 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