- Home /
Question by
Pemu · Oct 18, 2013 at 07:06 PM ·
networkingprefabmultiplayerplayerinstatiate
Unity Multiplayer - Instantiate prefab
Hi. I have a problem. I have two players (client and server). When I click "Fire1" should be created cube. And cube created but not 1 but 2. Because client and server have the same script. So how can I separate this?
Comment
Best Answer
Answer by nastasache · Oct 18, 2013 at 10:02 PM
If you have exactly the same script both on client and server, you have to write by code, in this shared script, what to do the client and what to do the server; otherwise (at least if script is instantiating something over network) both will do the same.
A way is to use: networkView.isMine
:
http://docs.unity3d.com/Documentation/ScriptReference/NetworkView-isMine.html