I have a screen space canvas and I simply want to move a “target” over an object in world space. My world space coordinate is obtained with a raycast and I do a debug draw to make sure it is correct. The problem is none of the following code is giving me the right result.
void Update ()
{
if( currentSelection==null) return;
// Translate world position to UI coordinates
RectTransform rt = (RectTransform) this.transform;
Vector3 pos = ( (RectTransform)rt.parent ).InverseTransformPoint( currentSelection.position );
rt.position = pos; // nether rt or rt.parent works!
}
Seriously no answers out there?
– Brickle