|
Hi, I'm trying Unitys network functionality for the first time. My current problem is the following: A player can But when the building spawns the unit the
Note: Both the units and buildings NetworkView are already added in the prefabs. Edit: Of course after asking the Question, a quick and dirty solution came to my mind:
Seems quick and dirty, works for the moment. But i'm not sure if its the optimal way to build on.
(comments are locked)
|
|
If the script is only responsible for spawning the units, just disable or remove the script on all other clients (server included). Just check in Start if you are the owner of this building.
if you still need some functionality of this script you can restrict the spawning to the owner just the same way: Sorry to bring this up again, but if I would instantiate something by using this method that I only want to be used on the client instantiating it and the server, would traffic still be sent to the other clients as well (and just be ignored)?
Aug 29 '12 at 07:12 AM
MestR
@MestR: Sorry, but i'm not sure what you mean ;) If you Network.Instantiate an object, it will be instantiated on all peers. All peers have to have an object with this networkviewID or you get massive errors. In theory you can delete a "networked" object only on one client, but the updates will still be sent and causes errors because there's no receiver. I've seen your question about SetScope, i will answer there since it seems related.
Aug 30 '12 at 02:07 AM
Bunny83
(comments are locked)
|
