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
0
Question by 0x7C00 · Nov 11, 2014 at 03:36 PM · physicscolliderphysics2dcollider2dparenting

Colliders2D not working under same parent?

During the development I have found strange Collider2D behavior in Unity 4.6.0f1 (not sure if it is a 4.6 issue?).

To reproduce a problem I created a separate project and very simple scene with 3 objects (Picture 1). Each object have only Rigidbody2D and BoxCollider2D. The red one have also simple move script (only add force in each direction on keypress).

When all objects are root in the scene hierarchy everything works fine (Picture 2). The problem occurs when those objects have the same parent:

Parent

  • TestObjectPlayer

  • TestObject

  • TestObject

  • TestObject

Than Colliders 2D stops working (Picture 3). The funny thing is that when I simply during run-time disable the Collider on the Player Object and than enable it again it starts working.

Is it a bug in 4.6 or normal behavior?

unity.png (53.3 kB)
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
0
Best Answer

Answer by bpolley · Nov 12, 2014 at 02:52 AM

This seems to be a bug in Unity 4.6.0f1: http://forum.unity3d.com/threads/unity-4-6-0b21-2d-colliders-broken.277341/

I'm having the same issue. Submit a bug report and hopefully it gets fixed soon.

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 MelvMay ♦♦ · Nov 12, 2014 at 08:08 AM 0
Share

Are the 'TestObject' prefab-instances?

avatar image 0x7C00 · Nov 12, 2014 at 09:03 AM 0
Share

Yes, I experienced the problem with the prefab instances. Not tested it with the standalone Objects (with no prefab) though.

avatar image bpolley · Nov 13, 2014 at 08:00 PM 0
Share

Yes, the objects are prefabs

avatar image
0

Answer by MelvMay · Nov 12, 2014 at 12:11 PM

This is what we're seeing here as it seems related to some prefab changes however your post seemed to indicate you were seeing it outside of prefabs.

Thanks for the confirmation.

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
0

Answer by 0x7C00 · Nov 13, 2014 at 07:02 PM

Found temporary solution until the bug is fixed. In Start() function just disable and enable Collider:

 collider2D.enabled = false;
 collider2D.enabled = true;

Or if you have multiple Colliders:

 Collider2D[] colliders2D = GetComponents<Collider2D>();
 foreach (Collider2D collider2D in colliders2D) {
     collider2D.enabled = false;
     collider2D.enabled = true;
 }

For me looks like it is working. I needed something to continue development.

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
0

Answer by IvanAlvarez · Nov 13, 2014 at 07:00 PM

A script like this on the same gameobject as each collider will let you at least work in the meantime:

 using UnityEngine;
 using System.Collections;
 
 public class ColliderBugFix46rc1 : MonoBehaviour {
 
     void Start () {
         collider2D.enabled = false;
         collider2D.enabled = true;
     }
 }
 
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 IvanAlvarez · Nov 13, 2014 at 07:04 PM 0
Share

Use a script like this in the gameobjects that have 2d colliders to have they work while a patch is released:

 using UnityEngine;
 using System.Collections;
 
 public class ColliderBugFix46rc1 : $$anonymous$$onoBehaviour {
 
     void Start () {
         collider2D.enabled = false;
         collider2D.enabled = true;
     }
 }
 
avatar image Linus · Nov 13, 2014 at 07:06 PM 0
Share

Your answer got sent twice for moderation. Converted second one to comment

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

6 People are following this question.

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

Related Questions

Using collider to gameobject detect attack or not 2 Answers

Is it possible to rotate a 2d collider in 3d? 0 Answers

How to check place on empty for placement polygon Rigidbody2d? 0 Answers

Triggers colliding when they are set not to in Collision Matrix 4 Answers

Collision 2d is not working perfectly 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