I do not understand what i am doing wrong here. I am trying the following:
1) Positioned 4 x Images (Cards) on UI scene
public Image aceHeartZone, aceClubZone, aceDiamondZone, aceSpadeZone;
2) The ace-cards are in the same hierarchy, in the Editor, as the normal cards:
3) I copy the positions from the AceXX cards to Vector2 properties
zone10 = aceHeartPos.rectTransform.localPosition;
zone20 = aceClubPos.rectTransform.localPosition;
zone30 = aceDiamondPos.rectTransform.localPosition;
zone40 = aceSpadePos.rectTransform.localPosition;
4) On the cards i have the following snippet:
_x = _prep.zone10.x;
_y = _prep.zone10.y;
myRectTransform.anchoredPosition = new Vector2(_x, _y);
5) And the card is not positioned correctly:
Behind the actual cards-images is the ace card-images, which is from where i pick the positions
QUESTION: What do I do wrong here?
First, thank you all. I feel pretty stupid I must say as i should have figured this out immediately. Problem is that I did mix localPosition and anchoredPosition!!!
I now changed everything except the drag code to anchoredPosition and it works.
Well, at least i learned something that I should have seen immediately...