Unity Network.Destoy problem.

Started by
11 comments, last by Dave Weinstein 10 years, 9 months ago
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?
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).
How would I prevent the code from being included with the client? AFAIK it's built into the unityengine.
dont code it in.




Oh, or do your clients have access to the source code?

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.

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.

enum Bool { True, False, FileNotFound };
So I guess Unitys built in networking is completely useless for any serious project? Guess I'll have to switch to Lidgren.

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.

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?
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.

This topic is closed to new replies.

Advertisement