How to set image position in Unity?

Viewed 25

How to set the y-coordinate of the image to the x-coordinate of the world space transform in unity c# script?

using System.Collections.Generic;
using UnityEngine;

public class GuageFollowPlayer : MonoBehaviour
{
    public GameObject player;

    void Update()
    {
        transform.position = Camera.main.WorldToScreenPoint(player.transform.position);
    }
}
0 Answers
Related