from github
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using Unity.Netcode;
|
||||
using UnityEngine;
|
||||
|
||||
// this script moves the name tag above the head
|
||||
|
||||
public class NameLabel : NetworkBehaviour
|
||||
{
|
||||
[SerializeField] private GameObject NameCanvas;
|
||||
[SerializeField] private GameObject MainCamera;
|
||||
|
||||
private void Update()
|
||||
{
|
||||
//if you are owner of the player object this script is attached to, move the name tag relative to your position
|
||||
// sync handled by PlayerComponent...Sync
|
||||
if (IsOwner)
|
||||
{
|
||||
NameCanvas.transform.position = MainCamera.transform.position + Vector3.up * 0.625f;
|
||||
NameCanvas.transform.rotation = Quaternion.EulerRotation(0, Quaternion.ToEulerAngles(MainCamera.transform.rotation).y + 135, 0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user