mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +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;
|
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()
|
void Update()
|
||||||
{
|
{
|
||||||
if (!isLocalPlayer) return;
|
if (!isLocalPlayer) return;
|
||||||
|
@ -22,6 +22,17 @@ public class Tank : NetworkBehaviour
|
|||||||
[Header("Stats")]
|
[Header("Stats")]
|
||||||
[SyncVar] public int health = 5;
|
[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()
|
void Update()
|
||||||
{
|
{
|
||||||
// always update health bar.
|
// always update health bar.
|
||||||
|
Loading…
Reference in New Issue
Block a user