更新
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace SpriteShadersUltimate.Demo
|
||||
@@ -5,28 +7,28 @@ namespace SpriteShadersUltimate.Demo
|
||||
public class Demo_DisplayTitle : MonoBehaviour
|
||||
{
|
||||
public Transform target;
|
||||
private RectTransform rectParent;
|
||||
|
||||
private RectTransform rectTransform;
|
||||
RectTransform rectTransform;
|
||||
RectTransform rectParent;
|
||||
|
||||
private void Start()
|
||||
void Start()
|
||||
{
|
||||
rectTransform = GetComponent<RectTransform>();
|
||||
rectParent = transform.parent.GetComponent<RectTransform>();
|
||||
}
|
||||
|
||||
private void LateUpdate()
|
||||
void LateUpdate()
|
||||
{
|
||||
Vector3 screenPosition = RectTransformUtility.WorldToScreenPoint(Camera.main, target.position);
|
||||
|
||||
|
||||
|
||||
Vector2 rectPosition;
|
||||
RectTransformUtility.ScreenPointToLocalPointInRectangle(rectParent, screenPosition, Camera.main,
|
||||
out rectPosition);
|
||||
RectTransformUtility.ScreenPointToLocalPointInRectangle(rectParent, screenPosition, Camera.main, out rectPosition);
|
||||
|
||||
rectTransform.anchoredPosition = rectPosition;
|
||||
|
||||
transform.localScale = target.lossyScale;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user