Can be called from main thread Error in working with events for server Listeners in unity

i use QuObject source for connecting to socket io server for sending and getting Listenrs (emits). like this :

socketConnection = IO.Socket("");
socketConnection.On(QSocket.EVENT_CONNECT, () =>

and this is my codes for creating delegate and event :

public delegate void SocketConnectionListener(); 

public event SocketConnectionListener OnSocketConnectionListener;
protected virtual void onConnectedSocket() => OnSocketConnectionListener?.Invoke();

and when i want to use this event for handling the connection through another script i get error in this like


the error is this :

SetActive() can only be called from the main thread.

so how can i solve this problem ?

Read more here:

Content Attribution

This content was originally published by unattainable at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: