架构大更
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace SpriteShadersUltimate.Demo
|
||||
@@ -7,28 +5,28 @@ namespace SpriteShadersUltimate.Demo
|
||||
public class Demo_DisplayTitle : MonoBehaviour
|
||||
{
|
||||
public Transform target;
|
||||
private RectTransform rectParent;
|
||||
|
||||
RectTransform rectTransform;
|
||||
RectTransform rectParent;
|
||||
private RectTransform rectTransform;
|
||||
|
||||
void Start()
|
||||
private void Start()
|
||||
{
|
||||
rectTransform = GetComponent<RectTransform>();
|
||||
rectParent = transform.parent.GetComponent<RectTransform>();
|
||||
}
|
||||
|
||||
void LateUpdate()
|
||||
private 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