IL2CPP runtime build random crashes

For “Scripting Backend”, IL2CPP will be the default for Unity. .Net is to be deprecated. Besides that I am noticing considerable performance gains from switching to this.

However, I had a nasty random crash that was very hard to troubleshoot in runtime builds. I eventually tracked it down to RVO Simulator using threads. Aron mentioned something in another thread that was kind of vague but absolutely fixed this. Sounds like the problem may be due to Unity IL2CPP and garbage collection. In any event this workaround fixes.

Quoting Aron:

In any case the finalizer is only a safeguard in case one was using an RVO simulator without using the Unity component wrapper for it. You should be able to safely remove it. Find this code in the RVOCoreSimulator.cs script and remove it:

/** Terminates any worker threads */
~Simulator () {
OnDestroy();
}

So with these settings, everything is working well and best performance in my testing:

Scripting Runtime Version: .NET 3.5 Equivalent
Scripting Backend: IL2CPP
API Compatibility: .NET 2.0 (or subset)

I have issues using .Net 4 for Scripting Runtime but will create another thread.

1 Like

Hi

Ok. Seems like that bug will take some time for Unity to fix.
I doubt many (if any at all) use the Pathfinding.RVO.Simulator class without the RVOSimulator component, so that destructor is not very useful anyway. I have removed it in my dev version now.