- Home /
RectTransform Rect inverted
For my inventory system, I try to get out, how to check if two (canvas-)items are overlapping.
It seems, there is no other way then to work with Rect.Overlaps(OtherRect).
The Problem is, I can't get the right Rect out of the canvas RectTransform.
If I use...
"ItemRect = new Rect(Item.GetComponent().rect)"
... or...
"ItemRect = new Rect(Item.GetComponent().localPosition, Item.GetComponent().rect.max)"
... I get the following inverted rect-calculation (1: Canvas start position // 2: Position where the rect.max is calculated from):
Red is the canvas shown, yellow the calculated rect. I can't find anything about this issue. Any suggestions how to work around this?
Your answer
Follow this Question
Related Questions
Keep RectTransform changes after animation 0 Answers
Settings a rect transform to zero 0 Answers
Good way to scale 3D GameObjects in a Canvas (Screen Space - Camera)? 1 Answer
Why RecTransform.rect.center.Set isn't working? 0 Answers
Converting into a parent RectTransform's Coordinates (and back again) 1 Answer