crash: stop EventInstance when stop Unity SOLVED

I’ve got an EventInstance that plays indefinitely. Stopping it with OnDestroy is great, except when you’re stopping Unity and your StudioSystem gets (sometimes) killed before your EventInstance, and then trying to stop your Event crashes Unity completely.

Here’s your fix.

So, as usual I’ve got things like:

FMOD_StudioSystem soundSystem;
FMOD.Studio.EventInstance zoom;

void Start () {
  //my StudioSystem is attached to my main camera, which is great
  // ..but also causes my Unity to crash indirectly 
  soundSystem  = cam.GetComponent<initSoundSystem>().soundSystem;  
  zoom = soundSystem.getEvent("/Rocks/rockShoot");
  zoom.start();
}

void OnDestroy()
{
  //do check to work while game is running and prevent crash when stopping Unity
  if (soundSystem!=null && soundSystem.System.isValid())
    zoom.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT);
}

Also, per usual with me, this is probably not the 100% correct path, but all of this stuff is hard to find and I hope this helps someone. Have fun.