Hey everyone,
i’m creating a third person multiplayer game. This works fine. I’m able to spawn prefabs and see this on all clients. I’m working with NetViews and state synchronization.
I also wrote a client witch only consisting of a GUI. I don’t want to share information about 3D objects. I just want to share some RPC’s between the GUI-Client and the game clients and game server.
My Problem now is that the GUI-Client receives all information including information of the 3D objects and cause of the prefabs and network views are not available run errors. Is there the possibility to connect different client types to a server and to receive not the hole date shared between game client and game server?
if you have the server translate the RPCs to corresponding client and gui client calls then yes (use server as target for the rpc call)
with a single RPC call, no not really
currently I’m spawning the player objects via network.instantiate(…). If the GUI client connects to the server the client tries to instantiate the player objects existing on the server, the problem is the player prefab doesn’t exist at the GUI client. How can the GUI client connect to the server without trying to spawn the player and getting information from players network views existing at the server?
I just want to get the client server connection via unity so i don’t have to take care for the network connection. Or is it not possible and i have to implement the server - GUI client communication via sockets?
Don’t use Network.Instantiate if you don’t have to. It buffers them up as RPC’s, and thusly anyone who connects will be given the message to instantiate those objects.
The other thing you can do is you can use the network groups, and put the network instantiates in a group that you disable receiving on the clients you don’t want them instantiated on.
something like:
// Stop receiving messages in group 0 from all players (clients)
for (var player : NetworkPlayer in Network.connections)
Network.SetReceivingEnabled(player, 0, false);