Search Unity

Mesh Collider Breaking on build

Discussion in 'Physics' started by pantang, Mar 22, 2020.

  1. pantang

    pantang

    Joined:
    Sep 1, 2016
    Posts:
    219
    Everything was working wonderfully until my last build when all the buildings in my scene stopped colliding and now I can walk through them all though other items in the world seem unaffected and they have the same settings, only my buildings wierdly though they were one of the first things added to my scene(low poly).

    This is only happening in my build and it still all works great in the editor

    any ideas of where Ive went wrong? Only thing I can think of is I added a load of trees with box colliders(terrain tool) is their an upper limit that I could of passed or is it something else?

    I know I had to change my box colliders from discreet to get them working correctly in build but I don't get that option with the mesh colliders.

    I have just removed them and added them again and it seems to have fixed the problem for now but any ideas on what ive done wrong or what has caused the problem for when it happens next time? I am just using the collider with the default settings.
     
  2. Paul-Sinnett

    Paul-Sinnett

    Joined:
    Nov 12, 2010
    Posts:
    27
    It seems that upgrading to 2019.3 they added a new cooking option. If you previously had a mesh collider with default cooking options, after upgrading it will no longer be default. It looks like you either have to reset it to default, or enable read/write options in the mesh.
     
    pantang likes this.
  3. DivakarVS

    DivakarVS

    Joined:
    Jan 25, 2021
    Posts:
    1
    hi I have same issue ....but i am procedural generating the mesh... And mesh collider is also procedural generated...Please some help here ....for that what should i do ??
     
  4. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,492
    Then please don't necro an old thread, start your own, spend some time and effort adding some detail and maybe someone will help you. It's easy to assume it's the exact same reason because it sounds like it, often it's completely unrelated.
     
  5. RedClawStudios

    RedClawStudios

    Joined:
    Apr 23, 2015
    Posts:
    6
    Hi, upgraded to 2022.2 ... game has been stable since 2018 now colliders all stopped working, all surfaces and characters. No collisions get detected or trigger.
    Super frustrating.
    Resetting does not seem to work, where is the read / write setting please? Can't find.
    Not good QA.
     
  6. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    1,929
    Read/write checkbox is found in the model tab of the mesh import settings. Select your mesh in the project, and you'll find them in the inspector.

    See the manual:
    https://docs.unity3d.com/Manual/FBXImporter-Model.html
    https://docs.unity3d.com/ScriptReference/Mesh-isReadable.html
     
  7. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    1,929
    Allow Unity to keep you mesh data on the CPU, for it to be used in the physics engine. You do this by setting the mesh's isReadable property to true:
    https://docs.unity3d.com/ScriptReference/Mesh-isReadable.html

    Otherwise, Unity will delete the CPU copy of the mesh once it's uploaded to the GPU for rendering.