Interkarma / daggerfall-unity

Open source recreation of Daggerfall in the Unity engine
http://www.dfworkshop.net
MIT License
2.7k stars 328 forks source link

Exceptions in DaggerfallMobileUnit #2569

Closed KABoissonneault closed 7 months ago

KABoissonneault commented 7 months ago

Users are experiencing frequent errors with the following callstack.

DaggerfallWorkshop.DaggerfallMobileUnit.OrientEnemy (System.Int32 orientation) (at <9bf28c68d79b48218c80373c9e1cf18f>:0)
DaggerfallWorkshop.DaggerfallMobileUnit.UpdateOrientation () (at <9bf28c68d79b48218c80373c9e1cf18f>:0)
DaggerfallWorkshop.DaggerfallMobileUnit.Update () (at <9bf28c68d79b48218c80373c9e1cf18f>:0)

The specific exception is "IndexOutOfRangeException: Index was outside the bounds of the array."

The problem is entirely contained in DFU code, but I suspect the cause might be mod related. Probably custom enemies or some graphics mod.

It could be a lot of arrays that have out-of-bounds... The MobileUnit summary has StateAnims, RecordSizes, ImportedTextures with Albedo and EmissionMaps, AtlasRects

Because of the random nature of this issue, I'd like to remedy this with proper sanitization and logs first. A verbose log is probably better than throwing an exception every frame. After that, I can know what exactly is invalid and fix the real issue later

KABoissonneault commented 7 months ago

Fixed by #2571