📜  世界空间常量大小 - C# 代码示例

📅  最后修改于: 2022-03-11 14:48:46.442000             🧑  作者: Mango

代码示例1
public float downScaling; // to configure the size
private float _distance;
private Canvas _canvas;

private void Update()
{
    _distance = Vector3.Distance(_canvas.transform.position, _canvas.worldCamera.transform.position);
    _canvas.transform.localScale = Vector3.one * _distance / downScaling;

    _canvas.transform.LookAt(_canvas.worldCamera.transform); // canvas content needs to be flipped 180°
}