• Advertisement
Sign in to follow this  

Unity Network.Destoy problem.

This topic is 1663 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've run into a problem using Unity I'm not sure how to solve. How can I prevent a player from calling Network.Destroy on game objects or otherwise prevent object destruction by players?

Share this post


Link to post
Share on other sites
Advertisement
Dont include Destroy functions in their code. Instead make them signal the server that they want to destroy something and let the server do Network.Destroy (if valid).

Share this post


Link to post
Share on other sites

I guess the OP is talking about someone unpacking the game's assets and script assemblies, and modifying the script bytecode to call Network.Destroy. I would think that cannot be prevented. You could rather use a 3rd party networking library such as Lidgren to do all the networking yourself, in which case you build all the network messages yourself and can do more extensive verification on the server against hacking.

Share this post


Link to post
Share on other sites

Someone with access to your client code will be able to modify the game state. There's no way around this.

 

Think about it: Instead of calling Network.Destroy(), the function, your attacker could simply inject a network packet that looks like the packet usually sent when Network.Destroy() is called.

 

This is why game rules need to always be enforced on the server side if you want to have a chance of reducing the surface area available to a cheating attacker.

Share this post


Link to post
Share on other sites
So I guess Unitys built in networking is completely useless for any serious project? Guess I'll have to switch to Lidgren.

Share this post


Link to post
Share on other sites

So I guess Unitys built in networking is completely useless for any serious project? Guess I'll have to switch to Lidgren.

 

Every networking scheme has exactly the same vulnerability.

 

If the Client isn't supposed to be able to destroy an object, you need to block that functionality at the Server.

Share this post


Link to post
Share on other sites
There's no way I know of to intercept a Destroy call and prevent it at the server. Do you know how I'd do it with the default networking?

Share this post


Link to post
Share on other sites
Dont use network.instantiate and/or dont attach a networkview to those objects. reference them by id or something similar. And use your own rpc's for all it's functions.

Share this post


Link to post
Share on other sites
Thanks but I've already switched to Lidgren, I think other clients could still be destroyed if a malicious player just looped through networviewIDs and called destroy on them.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement