c# - Creating objects at runtime -


I am working on a Unity 3D application that basically receives data from a server and the object on runtime Attempts to make When I am trying to create this object, then I have been defined on a few constructs through the constructor, I get the following error:

  get_name only by the main thread The constructor and field initiator will be executed while loading a load when a view will be loaded. Do not use this function in the constructor or field initiator; Instead, move the initialization code to alert or start function. I  

I can not take it from any awake or start, since I need some feedback

Any ideas / suggestions? You can not create an object in your constructor or you will get that error.

In fact, you should leave the consultants normally with Unity and follow the caution / start / etc.

I do not know what you are doing, but there is no reason why you can not make an instinctive object somewhere in your code, set it properly on the next lines of code, and After that, wake it up () / start () take place after it, it is being started completely.


Comments