Hello, so I got this script
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class HoverOverGameobject : MonoBehaviour {
public GameObject target;
public GameObject UIElement;
public Camera UICamera;
public Camera WorldCamera;
void Start() {
}
void LateUpdate() {
WorldCamera = NGUITools.FindCameraForLayer (target.layer);
UICamera = NGUITools.FindCameraForLayer (gameObject.layer);
Vector3 pos = WorldCamera.WorldToViewportPoint (target.transform.position);
pos = UICamera.ViewportToWorldPoint (pos);
transform.position = pos;
}
}
And it works perfectly at 16:9 or 16:10 aspect ratio.
But below that, it suddenly sorta lags to the side and isn't right on top of the object. I'm wondering if any of you could have some helpful advise on how to fix this?