Invalid AABB errors after switching to Unity 6

Hello.
Basically, I have this system where if some particles collide with an object, their data of collision point and normals sends to main decal render code. And in there I list all of them and use DrawMeshInstance() to render them. How ever since I upgrade it from 2019 LTS to Unity 6, I sometimes getting this errors:

Here is the draw function.

The how list<> are created and added. The red lines are stuff I added after switching versions.

This is a bug, I don’t know how to recreate. The “Stop on error” setting doesn’t work for Invalid AABB or any error comes from this, so I can’t get the exact moment even I recreate.

Lastly I added third red line, which is “…Quaternion.LookRotation(normal.normalized).eulerAngles;”, after that I couldn’t be able to recreate. But I’m still not sure, it’s fixed or not.

Here’s some updates.

I made a check if the decal spawn point and normal is valid.

bool CheckVectorNan(Vector3 v3, string s)
    {
        if (float.IsNaN(v3.x))
        {
            return true;
        }
        else if (float.IsNaN(v3.y))
        {
            return true;
        }
        else if (float.IsNaN(v3.z))
        {
            return true;
        }
        else if (v3 == Vector3.zero)
        {
            return true;
        }
        else if(v3.magnitude >= 250)
        {
            Debug.LogError(v3 + s);
            return true;
        }

        return false;
    }

At Last, I also checked if point is too far away from the origin.
And if it is, debug the position.

I got the bug again by luck and this is the log. I still can’t re create it consistently tho.

(0.00, 0.00, 237696600000000000000000000000.00)  point
UnityEngine.Debug:LogError (object)
DecalSpawner:CheckVectorNan (UnityEngine.Vector3,string) (at Assets/Scripts/Menejer/DecalSpawner.cs:251)
DecalSpawner:AddDecal (UnityEngine.Vector3,UnityEngine.Vector3,single,UnityEngine.Transform,UnityEngine.Color) (at Assets/Scripts/Menejer/DecalSpawner.cs:76)
BloodParticle:EmitParticle (UnityEngine.ParticleCollisionEvent,UnityEngine.GameObject) (at Assets/Scripts/BloodParticle.cs:64)
BloodParticle:OnParticleCollision (UnityEngine.GameObject) (at Assets/Scripts/BloodParticle.cs:55)

Right now, I belive the bug is about Particle system collision event intersection points.

Hi! I agree that this seems like an engine bug with particle collisions (assuming you aren’t positioning particles/colliders at such large coordinates)

If you have even a semi-decent repro, you could submit a bug report and we can try to recreate it here.

You’re doing the right thing by checking for NaNs. I recommend:

  • add a float.IsInfinity after the NaN check
  • change magnitude to sqrMagnitude

These changes may make your repro more consistent and reliable, although that really only helps us know your bug report would be solid. It still seems like an “us” problem and not a “you” problem!

2 Likes

Thanks a lot. I submited a bug report too.

I’ll also add those to if statement.

1 Like