ToString can only be called from the main thread. But there is no ToString in my code

I know there is aleardy a question with this topic, but I do not use .ToString at all or any other method that converts something in a string. Even if I search with strg + f. I am using Asynchronus Sockets to communicate between my server and the game.

In the error it marks me a line of code. It is the end bracket } of a method.

UnityMainThreadDispatcher.Instance().Enqueue(() =>
//Write all PlayerPrefs.Get…(), PlayerPrefs.Set…() commands or any other line that occurs a problem that needs to be called from main thread to HERE.


To use UnityMainThreadDispatcher you have to implement this script to your project

It would help :slight_smile: