It looks like you are using the 2.00 timeline example with the 2.02 integration- can you try using the 2.02 timeline example instead? One change is that we no longer recommend pinning the memory with GCHandleType.Pinned because it was causing some issues on iOS, but we haven’t encountered this with IL2CPP.
case FMOD.Studio.EVENT_CALLBACK_TYPE.STOPPED:
{
Debug.Log("Song ended event called");
RythmManager.instance.OnSongEnd();
}
break;
Errors like
WindowsPlayer UnityException: IsObjectMonoBehaviour can only be called from the main thread.
Constructors and field initializers will be executed from the loading thread when loading a scene.
Don't use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function.
UnityException: get_isActiveAndEnabled can only be called from the main thread.
Constructors and field initializers will be executed from the loading thread when loading a scene.
Don't use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function.
What is the best way to get back to the main thread from a
Hmm, there are probably some sophisticated .NET ways of dealing with this, but the simplest way I can think of would be to call RythmManager.instance.OnSongEnd() from Update(), and use an atomic operation to trigger it from your callback. Something like:
case FMOD.Studio.EVENT_CALLBACK_TYPE.STOPPED:
{
Debug.Log("Song ended event called");
onSongEndCalled = true; // Atomic primitive type assignment
}
break;