mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-17 18:40:33 +00:00
Benchmark/Tanks example: name players for easier debugging
This commit is contained in:
parent
fdc9369de4
commit
f74d072165
@ -6,6 +6,17 @@ public class PlayerMovement : NetworkBehaviour
|
||||
{
|
||||
public float speed = 5;
|
||||
|
||||
// naming for easier debugging
|
||||
public override void OnStartClient()
|
||||
{
|
||||
name = $"Player[{netId}|{(isLocalPlayer ? "local" : "remote")}]";
|
||||
}
|
||||
|
||||
public override void OnStartServer()
|
||||
{
|
||||
name = $"Player[{netId}|server]";
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (!isLocalPlayer) return;
|
||||
|
@ -22,6 +22,17 @@ public class Tank : NetworkBehaviour
|
||||
[Header("Stats")]
|
||||
[SyncVar] public int health = 5;
|
||||
|
||||
// naming for easier debugging
|
||||
public override void OnStartClient()
|
||||
{
|
||||
name = $"Player[{netId}|{(isLocalPlayer ? "local" : "remote")}]";
|
||||
}
|
||||
|
||||
public override void OnStartServer()
|
||||
{
|
||||
name = $"Player[{netId}|server]";
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
// always update health bar.
|
||||
|
Loading…
Reference in New Issue
Block a user