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;
}
}