Closed Arikaton closed 4 days ago
Thanks for pointing out the issue with callbacks not being dispatched to the main thread. We plan to address this in the next major release
Apologies that this issue has gone stale. In v5 of our Unity SDK, we have changed it so that callbacks are invoked on the main Unity thread. I haven’t seen any further reports of this. Please try upgrading the OneSignal SDK and if this is still an issue, please open a new report with updated information.
What happened?
In callback method i use
UnityEngine.Application.version
which requires to be called on main thread. I suggest to dispatch onesignal callbacks in unity to main thread. Or update documentation for transparency. In OneSignal versions 2.* java code usedunitySendMessage
which guarantee that callback will be invoked in main thread.In fresher versions OneSignal introduced a UnityMainThreadDispatch which only using for
OneSiganl.Default.GetTags()
calls. I suggest to wrapOneSignal.Default.NotificationOpened, OneSignal.Default.NotificationWillShow, OneSignal.Default.NotificationPermissionChanged
in UnityMainThreadDispatch.Post(). Also i submitted a bug with UnityMainThreadDispatch, see #542Steps to reproduce?
What did you expect to happen?
The callbacks calls not in main thread in unity
Unity version
2020.3.32
OneSignal Unity SDK version
3.0.4
Platform
Android
Relevant log output
Code of Conduct