- Home /
Multiplayer - creating server/client non-authorative with the FPS prefab
I'm trying to create a lan multiplayer game using the FPS prefab as the player.
I can instantiate the prefab on both client and server but the problem is that in each side I'm controlling both prefabs.
Thoughts?
Thanks for any help,
Hello, I dont have an answer, but, have you checked this? http://www.m2h.nl/files/$$anonymous$$2H_Networking_Tutorial.pdf
Answer by paulsz · Oct 19, 2010 at 05:08 PM
If you check out the multiplayer tutorial (the one with the Storm Trooper ) there is a script there called RigidAssign.js.
This makes sure that what you control locally is not also controlled by a network view.
You can make a script, call it FPSPrefabAssign.cs (I prefer C# for scripting) and assign it to the FPSPrefab (the prefab that you instantiate and has attached a NetworkView component).
The only thing you have to write in the FPSPrefabAssign.cs script is:
void OnNetworkInstantiate( NetworkMessageInfo msg ) {
//get the script that is sent over the network through the NetworkView
FPSNetworkSynchronizer ns= (FPSNetworkSynchronizer)GetComponent(typeof(FPSNetworkSynchronizer));
if ( networkView.isMine )
{
ns.enabled = false;
}
else
{
name += "(Remote++)";
ns.enabled = true;
}
}
Hope this helps. It is much better if you also take a look at the tutorial, you'll better understand this (possible) solution.
thats says this Assets/Network/Networking Scripts/NewBehaviourScript.cs(10,5): error CS0246: The type or namespace name `FPSNetworkSynchronizer' could not be found. Are you missing a using directive or an assembly reference?
Your answer
Follow this Question
Related Questions
Prefab not spawning on client correctly 1 Answer
Photon Networking Instantiating Problem 0 Answers
For my multiplayer FPS, the 3rd person character is not moving 0 Answers
Cant move FPS controller 1 Answer
yield WaitForSeconds c# 4 Answers