my-unity-assets / Assets /Scripts /Interact /InteractionUI.cs
AliAch's picture
Introduced a new interaction system to standardize and manage object interactions.
dfdb6c1
Raw History Blame Contribute Delete
552 Bytes
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class InteractionUI : MonoBehaviour
{
public Image image;
public Transform handle;
public void setUI(Sprite sprite, Transform handleTransform)
{
image.sprite = sprite;
handle = handleTransform;
}
private void FixedUpdate()
{
if(handle != null)
{
image.rectTransform.position = InteractionManager.instance.playerCam.WorldToScreenPoint(handle.position);
}
}
}