Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ScreenSpaceOverlayの時に対象を追跡するUI
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class UIFollowTarget : MonoBehaviour
{
RectTransform rectTransform = null;
[SerializeField] Transform target = null;
void Awake()
{
rectTransform = GetComponent<RectTransform> ();
}
void Update()
{
rectTransform.position = RectTransformUtility.WorldToScreenPoint (Camera.main, target.position);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.