- Home /
How do I set rectTransform properties of one image to another which differ in anchor and parent transforms (script)?
SCENARIO: I have two images A and B.
Image A:
Child to another Gameobject
Screenshot : https://s3.postimg.org/ubmtlp9mb/Screen_Shot_2017_02_15_at_8_19_36_PM.png
Image B:
Present at the root. Screenshot : https://s21.postimg.org/4nigfaycn/Screen_Shot_2017_02_15_at_8_19_48_PM.png
ISSUE:
I want Image B to have the exact properties as A.
TRYOUTS:
Vector2 _size = ImageA.rectTransform.sizeDelta;
Vector2 _pos = ImageA.rectTransform.anchoredPosition;
ImageB.rectTransform.sizeDelta = _size;
ImageB.rectTransform.anchoredPosition = _pos;
REQUEST:
I see a lot of difference in Images between the two apart from size delta and position. How do I script if I want to make a clone of Image A on B without instantiating another game objects.
Thank you.
Your answer
Follow this Question
Related Questions
RectTransform outline and position aren't synced 0 Answers
LeanTween.moveLocal sometimes snaps to position rather than moving over time 0 Answers
Force UIImage to stay on viewport? 0 Answers
UI fade with CanvasGroup vs of Image.color.alpha or Text.color.alpha performance 1 Answer
Trying to place an UI Canvas Image next to another UI Image 1 Answer