I get an UnityException when leaving PIE or loading a new scene.
UnityException: get_dataPath can only be called from the main thread.
Due to the asynchronous nature of leaving a room operation, the current recommendation is to avoid invoking this
function within OnDestroy
if the scene is being unloaded. Scene unloading could occur when transitioning between
scenes or shutting down an application.
Instead, the best practice is to call the LeaveRoom
function and subsequently wait for the
OnRoomLeft
event to be triggered. Once this event has been triggered, it is then safe to perform further actions,
such as calling LoadScene
or Application.Quit
.
See also
- Building on macOS or iOS does not work anymore after Odin integration.
- Does 4Players ODIN support Apple Silicon?
- How do I access the live audio feed?
- libodin.dylib can't be opened because Apple cannot check it for malicious software
- room.UpdatePosition does not work or works incorrectly
- Which platforms does ODIN support for Unity?
Still need help?
Please check out support options like AI chatbot, Discord community and premium support packages.
Get in touch