Search Unity

Unity 4.6.0b21 2D Colliders broken.

Discussion in 'UGUI & TextMesh Pro' started by Neterea Studios, Oct 31, 2014.

  1. Neterea Studios

    Neterea Studios

    Joined:
    May 7, 2013
    Posts:
    23
    Something that was working with Unity 4.6.0b20 is not working on Unity 4.6.0b21.

    I have a character with a basic setup (same as tutorial for character controller):
    - Rigid Body 2D
    - Circle Collider 2D
    - Box Collider 2D

    In 4.6.0b20, the character falls and the colliders follow him as expected. So when a collision is found stops.

    In 4.6.0b21, the character falls but the colliders remain in the same place. Because of this, no collisions happen, so the character keeps falling.

    Something has changed and I must do something different or it is a bug?
     
  2. Neterea Studios

    Neterea Studios

    Joined:
    May 7, 2013
    Posts:
    23
    Sorry guys,

    This is not working for me also in Unity 4.6.0RC1.

    I think something is happening with RigitBody2D and 2D Colliders. Although I tried creating a basic example just with Unity objects and I'm not able to reproduce the problem. But when I open my project with Unity 4.6.0b20 everthing is working and my character is walking over colliders and with newer versions is falling.

    I also tried to create again my prefabs from the begining and sometimes it worked and sometimes the error reapeared without explanation. I will continue trying to find why this is happening.
     
  3. ihalila

    ihalila

    Joined:
    Feb 27, 2013
    Posts:
    2
    I've encountered issues with 2D colliders and rigidbodies in 4.6 RC1 too. What I found was that if you have 2D physics objects that are instances of a prefab and nested under other regular gameobjects they stop working correctly. The behaviour I saw was really weird, only the last object in the hierarchy would work correctly, while the others would update their position but their collider wouldn't move with the object.

    I set up a minimal project that reproduces the issue and submitted it with a bug report.
     
  4. Neterea Studios

    Neterea Studios

    Joined:
    May 7, 2013
    Posts:
    23
    Thanks ihalila!

    I think is the same problem I'm having. My objects update their position but their colliders are not moving with them. I'm glad you realised how to reproduce the problem and submitted a bug.

    This could have been a horrible bug if entered 4.6 final.
     
  5. bpolley

    bpolley

    Joined:
    Mar 18, 2014
    Posts:
    10
    I'm experiencing the same problem. However, it only seems to happen in playmode. Collisions work fine again in published builds.
     
  6. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,455
    Can you please provide me with the case number?
     
  7. ihalila

    ihalila

    Joined:
    Feb 27, 2013
    Posts:
    2
    It's Case 646715. I can also confirm that the physics did work correctly when I made an Android build and tried on a device, as well as when I opened the attached project in 4.6.0b20.
     
  8. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,455
    Thanks, looking now.
     
  9. 0x7C00

    0x7C00

    Joined:
    May 18, 2014
    Posts:
    24
  10. 0x7C00

    0x7C00

    Joined:
    May 18, 2014
    Posts:
    24
  11. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,408
    Sounds like related problem what i had just now ( case 647688 ), using 4.6.0f1

    If you move sprite+rigidbody2d with rigidbody2D.MovePosition(),
    then boxcollider2D doesnt follow the game object anymore (this worked fine in 4.6.0beta20)

    But note, this also only happens in editor, if you publish then it works as expected..
     
  12. 0x7C00

    0x7C00

    Joined:
    May 18, 2014
    Posts:
    24
    Yea, but debugging outside the editor would be.... not optimal :confused:
     
  13. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,455
    I've verified that this relates to a prefab change in a 4.5 patch release that was ultimately merged into 4.6. Whilst the prefab change didn't directly cause the issue, it revealed another problem elsewhere. This has had the side-effect of causing problems in at least the 2D physics collider set-up. Disabling then re-enabling the collider will cause it to be created correctly as has been reported and matches what I'm seeing here.

    I am working on a solution to this right now as a priority and will report back ASAP.
     
    Last edited: Nov 13, 2014
  14. IvanAlvarez

    IvanAlvarez

    Joined:
    Apr 30, 2013
    Posts:
    9
    A script like this on the same gameobject as each collider will let you at least work in the meantime:

    Code (CSharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4.  
    5. public class ColliderBugFix46rc1 : MonoBehaviour {
    6.  
    7.     void Start () {
    8.         collider2D.enabled = false;
    9.         collider2D.enabled = true;
    10.     }
    11. }
    12.  
     
  15. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,455
    Just a heads-up that whilst 4.6RC2 has just come out (http://unity3d.com/unity/beta/4.6), a fix for this issue won't be in it because that release was already in the QA pipe when the I was notified of the issue.
     
  16. IvanAlvarez

    IvanAlvarez

    Joined:
    Apr 30, 2013
    Posts:
    9
    could you tell us whats the ETA for next version?
     
  17. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,455
    Unfortunately not. This may even go into a patch release for 4.6.
     
  18. Neterea Studios

    Neterea Studios

    Joined:
    May 7, 2013
    Posts:
    23
    When you say: "even as a patch release for 4.6" are you meaning that it is possible to release Unity 4.6 final with this bug and they solve this with a patch?
     
  19. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,455
    I will be pushing a fix for this that will make it into the next 4.6 release candidate. When I posted earlier, the only fix we had was too high a risk for the next 4.6 release however since then we have found a low-risk workaround option that still resolves this issue. We will still look at making internal modifications for the 4.6 patch release however.

    I was simply trying to be as transparent about the process here as possible. :)
     
    Last edited: Nov 17, 2014
  20. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,455
    I'm looking at your case but it doesn't have an example attached. Indeed, MovePosition (and other stuff) fails due to this issue but only if the GameObjects are prefab instance. I did a test of your case, setting them up as prefab instances, and indeed they fail but with the fix I mention above it works again.

    If you are indeed using prefab instances then please let me know and I'll resolve the case and you can expect to see it fixed in 4.6RC3.
     
  21. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,408
    Problem (647688) solved in 4.6RC3, thanks!
     
  22. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,455
    Thanks for confirming that!