- Home /
Corners of RectTransform as Vecter[]
Hey I can't seem to figure this out, hope someone knows how. I want be able able to get the vector2 points of each corner from a rectTransform. some pseudocode
Vector2[] corners = rectTransform.GetConrers();
Pretty much want to know, is this corner outside view port. Then I can handle it from there.
Cheers.
Comment
Best Answer
Answer by sleepandpancakes · Jun 19, 2017 at 01:57 AM
You seem to be looking for RectTransform.GetWorldCorners or RectTransform.GetLocalCorners, both of which return Vector3[]. You can then probably just ignore the z values of the Vector3's and use them as Vector2's.
yea, just as you say that I found this http://answers.unity3d.com/questions/1012837/convert-local-point-in-recttransform-to-screen-spa.html