- Home /
Multiplayer: Why dont things move for both players C#
With the exception of the players, any other object that can move or do anything only does it on one persons screen. for example if Player1 picks up a gun, the gun does not disapear on Player2's screen, or if Player1 opens a door the door does not open on Player2's screen. i put network view components on all moving objects but that dosnt help. also only the host can see the other players, non-host players cant see the host. Also if it matters im using Photon Networking.
Thanks for any help.
Answer by AndyMartin458 · Jul 25, 2014 at 06:40 PM
Well, I can only assume that you aren't networking the movement of those objects. I'm not familiar with Photon, but I know a lot about networking. For instance, here is some pseudocode for a door movement.
public class NetworkedObject : MonoBehaviour
{
//This is called on the player
public void OpenDoor()
{
//It opens the door on your screen and calls the send message
DoDoorStuff();
OnDoorOpen();
}
//This sends a message to the other clients that the door is open
public void OnDoorOpen()
{
SendNetworkedDoorMessage();
}
//receive callback
//This is waiting for messages from other clients about the door
public void OnDoorMessage(string message)
{
if(string.compare("open", meessage) == 0)
{
DoDoorStuff();
}
}
}
Well i fixed it by using network.instantiate and network.destroy where applicable but the animations are still un-synced
$$anonymous$$ake sure you're synchronizing data with RPC calls.
There's plenty of tutorials on RPCs with Photon, but quill18creates does great explaining on YouTube.
Your answer
Follow this Question
Related Questions
Multiplayer cant see host player C# 0 Answers
A node in a childnode? 1 Answer
Distribute terrain in zones 3 Answers
RPC called by OnPhotonPlayerConnected doesn't work 2 Answers
Multiple Cars not working 1 Answer