Unable to instantiate a gameobject outside the main

I’ve got a TCP connection running in a thread different from main. The infomration is inconsistent. I just wait indefenetly until I recieve some stuff. When I get the info, I have to instantiate a prefab, which I can’t do for some reason. Unity says I can only instantiate an object from the main thread. Are there any built-in ways around that problem? If so, please speak just a little bit on the topic. I’m new at programming on Unity so “try that” probably won’t really help. I’d be very thankful guys.

See what happens when you actually describe your problem? Now I can help you!
(Simply writing “That’s all you need to know” isn’t very informative, especially when your question itself doesn’t make sense ;))

I believe the problem is that Instantiate is a function of the MonoBehaviour class, which is not extended by the class you made.

The easiest way to solve this is to create a script within unity (lets say PrefabMaker) and put it on a gameobject on the stage. Then on the script you can put this

static void MakePrefab(){
        Instantiate();
}

You can then put all your instantiate code on there, and you can call that function anywhere in your game by writing PrefabMaker.MakePrefab();

Yeah, sorry. Thanks for trying to help. It’s just that this problem has been bothering me for some time.

The problem is that I actually did inherit my class from MonoBehaviour. I’m not sure your way will work since I have to transform those prefabs right after I create them. Also, sorry if I’m being stupid, but I don’t see a connection between inheriting a class from monobehaviour and multithreading issues.