File size: 552 Bytes
dfdb6c1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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);
        }
    }
}