I have difficulty moving UI elements to one another on Unity.
I want to create a function that takes 2 RectTransforms and returns me a position of second objects relative to the first (don't mind more parameters if needed)
I want to move Equipments inner image to currency

RectTransfom a = Equipments inner image;
RectTransfom b = currency;
the problem is that both ui elements are childs and anchored to different places so I cannot do a simple lerp from b.position to a.position
because their position is relative to all of their parents
is there an easy solution to get the actual position without always calculating the position to the anchored to their parent (and so on till there is only the canvas)?
I've tried to receive the position and calculate it based on the anchored position but it seems that I need to do it until there is no parent which looks like not efficient way to do so but maybe I'm wrong