c# - Unity, Client Object Destroying -


hey guys got problem destroying objects on network client right ive got pickup system walk objects , pick them up, when pick them added inventory , item on ground destroyed. works fine when server picking items when client simplily doesnt work add item inventory. see things time how make command command , doesnt seem work, items interacting have local player authority , registered , player has local player athority doesnt work. script

[command] public void cmdadditem(gameobject hitcollider, int i)  {     clientscene.registerprefab (hitcollider);     networkserver.destroy (hitcollider); } 

i have done same thing clientrpc (it exact same code , called same time command) still doesnt work thanks

if want server destroy given object first has registered spawnable prefab on networkmanager of clients, has have networkidentity , has spawned server.

if you've got call function:

    [command]     public void cmddestroyobject(networkinstanceid netid)     {         gameobject theobject = networkserver.findlocalobject (netid);         networkserver.destroy (theobject);     } 

where netid networkinstanceid of object want destroy.


Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

transpose - Maple isnt executing function but prints function term -