Problem with event handling in Unity
Posted: 19 Sep 2018, 12:51
I've got a problem with unity client API.
If I set ThreadSafeMode to false, smartfox fires events normally but when I try to access any game objects from the event handler I get this error in unity
But if I set ThreadSafeMode to true, SmartFox never fires any events.
It seems like a complete stalemate.
Is there any way to get around this?
If I set ThreadSafeMode to false, smartfox fires events normally but when I try to access any game objects from the event handler I get this error in unity
get_gameObject 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.
UnityEngine.Component:get_gameObject(Component)
But if I set ThreadSafeMode to true, SmartFox never fires any events.
It seems like a complete stalemate.
Is there any way to get around this?