I'm working on an Unity3D application that basically fetches data from a server and attempts to create objects at runtime. When I'm trying to create this objects, via a constructor on some classes I have defined, I get the following error:
get_name 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
I can't move this to either Awake or Start since I need some feedback from my GUI (user credentials) before I run the mentioned code.
Any ideas/suggestions?
I was able to make it work. Here's a summary of what I did: