RVO fails on scene reload

When using RVO, at first load it runs fine, but when reloading the scene, it fails to get the RVOSimulator, debugging this in Awake : “No RVOSimulator component found in the scene. Please add one.”

Fixed it by replacing :

cachedSimulator = cachedSimulator ?? FindObjectOfType(typeof(RVOSimulator)) as RVOSimulator;

by

if((cachedSimulator == null))
            cachedSimulator = FindObjectOfType(typeof(RVOSimulator)) as RVOSimulator;

I was surprised to see the “??” operator in your code as I was sure it was not working on Unity, turns out it sort of works then?
Debugging showed up that even though cachedSimulator was null, and the findobject wasn’t, it’d still pick the cachedSimulator.

Oh, that was a stupid bug.
Yeah, == null does not work exactly the same way as ??. == null will use Unity’s null checking to check if it is null OR destroyed. Using ?? will only check if the reference is null which it will not be for a destroyed object.
I will fix this in the next update.

Just uploaded 3.8.2 which fixes this bug.