创建标签系统包
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace MuHua
|
||||
{
|
||||
public class LabelFollower : MonoBehaviour
|
||||
{
|
||||
public Transform target; // 要跟随的目标物体
|
||||
public Vector3 offset; // 标签的偏移量
|
||||
void Update()
|
||||
{
|
||||
if (target != null)
|
||||
{
|
||||
// 设置标签的位置
|
||||
transform.position = target.position + offset;
|
||||
|
||||
// 使标签面向相机
|
||||
transform.rotation = Camera.main.transform.rotation;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user