The NetworkManager instantiates a Player prefab. This is your Player Object.
In a two player game, your GameObjects exist conceptually in 3 places, and logically in 2 places. An object exists on each game client, and on the game server. If the game server is also a client, it is called a host, and it shares the GameObject with the client.
- only methods on components on the Player Object can have the [Command] attribute.
- you can only call [Command] methods from other methods on the Player Object.
It is hard to see which code is server code, and which is client code. I recommend using the [Server] and [Client] attributes liberally to add this information to the source code. When this attribute cannot be applied to a method (only NetworkBehaviours support this attribute) then add the attribute inside a comment.
The NetworkTransform does not provide interpolation when in Transform mode, only when using RigidBody mode. You will need to write this code yourself using [SyncVar].
For fast iterative development, keep the NetworkManager in your development scene, and add the NetworkManagerHUD component. Set this scene as your startup scene, then Build and Run, choose Host or Client from the GUI, then press Play in the editor, and choose Host or Client.
NetworkServer.Spawn only create an instance on the client, and sets it's transform component to match the server. You will have to do any other configuration on this object via a secondary [ClientRpc] call.
So, you've created a car prefab using WheelCollider components, and now you can apply a motorTorque to make the whole thing move along. ...
When you start working with threads in your Unity3D project, you will discover that many things need to be done in the main loop. For exampl...
Possibly slightly more correct lighting. The rim light is now only applied in the direction of the sun, rather than being purely based on v...
If you call gameObject.GetComponent , and there is no Collider on that gameObject, null is returned, but you will also see a memory allocati...
Thank to Adrian Boeing I was inspired this morning to hack together a ripple shader for Unity3D. Thanks for the math Adrian. You can see t...
import csv open("output.tsv", "w").write("\n".join("\t".join(e.strip() for e in i) for i in csv.rea...
Often, when building a game, you need to test if objects are colliding. The objects could be spaceships, rocks, mouse pointers, laser beams....
Working with multiple threads is often a necessary evil. This is how I do it safely inside a Unity3D component. There are only certain time...
UniWeb now includes a tiny embedded web server which you can use to do crazy things. That is all.
I've just seen and used a brilliant ssh option. The command: sudo ssh -D localport user@externalhost will set up a local SOCKS proxy l...