Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Bug Physics.Raycast() causing PhysX errors in Linux build

Discussion in 'Linux' started by LukaKotar, Jan 18, 2020.

  1. LukaKotar


    Sep 25, 2011
    The following error appears when raycasting towards certain meshes in built player. So far, I haven't been able to reproduce this in a fresh project (even by using the affected meshes and their .meta files), so I cannot submit a bug report as of yet.

    Code (CSharp):
    1. [Physics.PhysX] TriangleMesh::loadFromDesc: desc.isValid() failed!
    2. UnityEngine.PhysicsScene:Internal_Raycast_Injected(PhysicsScene&, Ray&, Single, RaycastHit&, Int32, QueryTriggerInteraction)
    3. UnityEngine.PhysicsScene:Internal_Raycast(PhysicsScene, Ray, Single, RaycastHit&, Int32, QueryTriggerInteraction)
    4. UnityEngine.PhysicsScene:Raycast(Vector3, Vector3, RaycastHit&, Single, Int32, QueryTriggerInteraction) (at /home/builduser/buildslave/unity/build/Modules/Physics/ScriptBindings/Dynamics.bindings.cs:700)
    5. UnityEngine.Physics:Raycast(Vector3, Vector3, RaycastHit&, Single) (at /home/builduser/buildslave/unity/build/Modules/Physics/ScriptBindings/Dynamics.bindings.cs:1041)
    6. Player:OnAnimatorIK() (at /home/user/Path/To/Project/Assets/Code/Player/Player.cs:417)
    I don't know what's causing it, but this is the information that I have:
    • The error points to a line that does a simple raycast. If I comment the line out, the error will point to the next Physics.Raycast() or Physics.SphereCast() operation.
    • Disabling "Graphics Jobs" in player settings used to resolve this error in previous versions of Unity (based on my git log, 2019.2.0b4 was fine, and I think the beta versions of 2019.3 (before f1) worked too)
    Maybe someone with access to the Unity source code can share a few ideas?

    Edit: I forgot to mention, I started seeing this error after I swapped out my Nvidia graphics card for an AMD one (Radeon RX 580)

    Edit 2: Looks like the issue only occurs when static batching is turned on

    Edit 3: The error resurfaced when I continued working on my level, even with static batching turned off.

    Edit 4: I decided to remove certain directories inside "Library" including "metadata" and a few others to see if this would fix an unrelated issue, which it did (my project would take over 5 minutes to open, but now it opens reasonably quickly). I've been experimenting a little I think it fixed this error as well, as I haven't seen it since. I'll update the post if I start seeing it again.
    Last edited: Mar 10, 2020
    Chennault and sgt3v like this.
  2. joanpescador


    Dec 21, 2016
    Same issue here.
    Everything is working fine but still getting this error:
    [Physics.PhysX] TriangleMesh::loadFromDesc: desc.isValid() failed!
    Any advance there? I use Nvidia card too.