Rect.Contains cannot take a Rect as an argument , only a Vector2 ??

i need to make sure rectangles i am generating are not inside each other and apparently unitys system does not have Rect.Contains(Rect),
it throws an invalid argument error if i use one

is there a way to use this function or import it from the .net framework somehow ,

this would save me huge amounts of work so thanks for any help

Well, naturally…did you read the docs for Rect.Contains?

function Contains (point : Vector2) : boolean

function Contains (point : Vector3) : boolean

Description

Returns true if the x and y components of point is a point inside this rectangle.

You can make your own function easily enough for seeing if a rect is inside another rect.

alright so i went and typed my own function for this it check if the border of every rectangle generated is inside every other rectangle and if it is it refuses it and orders for a new one in its place

accepted rectangles are stored to an array

here is the code if anyone ever need it , it was good practice

to see if a Rect contains another Rect, just check if it contains both its top-left and bottom-right corners. For 3D rects do similarly (thetwo opposite 3D corners needed)

public static bool Contains(this Rect self, Rect rect) {
return self.Contains(new Point(rect.Left, rect.Top)) &&
self.Contains(new Point(rect.Right, rect.Bottom));
}

here’s an example from Silverlight which doesn’t have a Rect.Contains(Rect), but only a Rect.Contains(Point)

the above is a static extension method which you can defined in a static class, say called RectExtensions (you can find more such extensions on the net if you search for that name btw)

Then you just import that class in your source file and all your Rect instances magically get a method (in recent .NET Runtime versions) that accepts a Rect and returns a bool saying if that Rect is contained in the Rect you called the method upon