- Home /
Which Game Objects need Network Identities and which game objects don't in order to transfer data between the server and the client?
I'm making a 2-d multiplayer meant to be played on 2 separate screens, one for each player. The gameplay involves each person interacting with the same map. I'm having trouble figuring out how to transfer data between the server and the client. I do not have a player prefab that instantiates whenever a person joins, because it isn't necessary (this is okay, right?). The problem is, I can't get data to transfer between the server and the client. I understand that Network Identities and Network Transforms have to be used, but I don't know which game objects need them. For instance, If I press a button that immediately turns black on the server, I want the client's button to turn black as well. Would I put the network identity and network transform components on the button in this case?
EDIT: I'm actually getting an error saying "The PlayerPrefab is empty on the Network Manager. Please setup a PlayerPrefab object." Can I just ignore this? There is nothing for me to spawn when a player joins the game.
Answer by FoodLover195 · Oct 21, 2018 at 02:25 AM
@jnguyen54228 No, I'm pretty sure you need to spawn a player prefab. I haven't done a multiplayer game in a while, so I could be wrong. I believe what you would want to do is spawn an empty gameobject with whatever scripts are required to act as a connection between the server and client. Then have the player's controls on that prefab regardless if they are actually controlling physical character or not.
Your answer
![](https://koobas.hobune.stream/wayback/20220612180700im_/https://answers.unity.com/themes/thub/images/avi.jpg)