- Home /
How to instantiate gameobjects through udp?
I need to instantiate a game objects through udp connection. So, I've Udp server, gameobjects in the scene and xml file with current gameobjects and float variables for each of them in it. In other side the client udp that sends the float values for transforming a bunch of gameobjects according to the xml file. Do you guys have any ideas or ready to use solutions to accomplish transforming a bunch of game objects trough udp according to gameobjects name in xml and their variables?
Client side: There is UDP client, gameobjects, in the scene and xml( unassigned variables to gameobjects). For instance:
<Type="float" Name="x_out" UnityObject="CraneBoom">
<Type="float" Name="y_out" UnityObject="CraneBoom">
<Type="float" Name="z_out" UnityObject="CraneBoom">
...
Server side: Server UDP sends randomly generates float values; What I need to do is to get all "UnityObject" from xml, find them in the scene and somehow assign the float values from the server to the gameobjects according to the "Name" in the xml. My problem is I cant figure it out how to assign the float values from the server to the game objects according to the "Name".
To make question more clear I need to do something like that: UDPReceive.UpdateGameObject(object[i], objectIndex[i])
UdpReceive - client; UpdateGameObject - function that going to instantiate a GameObject according to object[i], objectIndex[i]; object[i] - array of GameObjects deserialized from xml attribute "UnityObject"; objectIndex[i] - array of the index counting all attribute values of the "Name";