# SRectTransform

**Members** 13

|          |                                                                 |                                                                                                                       |
| -------- | --------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
| Function | [SetParent](#setparent)                                         | Set the parent of the transform.                                                                                      |
| Function | [SetInsetAndSizeFromParentEdge](#setinsetandsizefromparentedge) | Set the distance of this rectangle relative to a specified edge of the parent rectangle, while also setting its size. |
| Function | [SetSizeWithCurrentAnchors](#setsizewithcurrentanchors)         | Makes the RectTransform calculated rect be a given size on the specified axis.                                        |
| Property | [Rect](#rect)                                                   | –                                                                                                                     |
| Property | [anchorMin](#anchormin)                                         | The normalized position in the parent RectTransform that the lower left corner is anchored to.                        |
| Property | [anchorMax](#anchormax)                                         | –                                                                                                                     |
| Property | [anchoredPosition3D](#anchoredposition3d)                       | –                                                                                                                     |
| Property | [anchoredPosition](#anchoredposition)                           | –                                                                                                                     |
| Property | [sizeDelta](#sizedelta)                                         | The size of this RectTransform relative to the distances between the anchors.                                         |
| Property | [pivot](#pivot)                                                 | The normalized position in this RectTransform that it rotates around.                                                 |
| Property | [offsetMin](#offsetmin)                                         | The offset of the lower left corner of the rectangle relative to the lower left anchor.                               |
| Property | [offsetMax](#offsetmax)                                         | The offset of the upper right corner of the rectangle relative to the upper right anchor.                             |
| Property | [GameObject](#gameobject)                                       | –                                                                                                                     |

## Functions

### SetParent

void SetParent([SGameObject](/docs/scripting/client-scripting-api-reference/types/sgameobject.md) parent, bool worldPositionStays)

Set the parent of the transform.

Parameters

| Name               | Type                                                                               | Default |
| ------------------ | ---------------------------------------------------------------------------------- | ------- |
| parent             | [SGameObject](/docs/scripting/client-scripting-api-reference/types/sgameobject.md) | –       |
| worldPositionStays | bool                                                                               | –       |

Returns

`void`

Example

**Lua**

```lua
Space.Host.ExecutingObject.RectTransform.SetParent(anotherGameObject)

```

### SetInsetAndSizeFromParentEdge

void SetInsetAndSizeFromParentEdge(int edge, float inset, float size)

Set the distance of this rectangle relative to a specified edge of the parent rectangle, while also setting its size.

Parameters

| Name  | Type  | Default |
| ----- | ----- | ------- |
| edge  | int   | –       |
| inset | float | –       |
| size  | float | –       |

Returns

`void`

Example

**Lua**

```lua
Space.Host.ExecutingObject.RectTransform.SetInsetAndSizeFromParentEdge(2, 3.0, 10.0)

```

### SetSizeWithCurrentAnchors

void SetSizeWithCurrentAnchors(bool vertical, float size)

Makes the RectTransform calculated rect be a given size on the specified axis.

Parameters

| Name     | Type  | Default |
| -------- | ----- | ------- |
| vertical | bool  | –       |
| size     | float | –       |

Returns

`void`

Example

**Lua**

```lua
Space.Host.ExecutingObject.RectTransform.SetSizeWithCurrentAnchors(true, 10.0)

```

## Properties

### Rect

[SRect](/docs/scripting/client-scripting-api-reference/types/srect.md) Rect {get; }

Example

**Lua**

```lua
rect = Space.Host.ExecutingObject.RectTransform.Rect

```

### anchorMin

[SVector](/docs/scripting/client-scripting-api-reference/types/svector.md) anchorMin {get; set; }

The normalized position in the parent RectTransform that the lower left corner is anchored to.

Example

**Lua**

```lua
Space.Host.ExecutingObject.RectTransform.anchorMin= Vector.New(0.3,0.3,0)

```

### anchorMax

[SVector](/docs/scripting/client-scripting-api-reference/types/svector.md) anchorMax {get; set; }

Example

**Lua**

```lua
Space.Host.ExecutingObject.RectTransform.anchorMax= Vector.New(0.7,0.6,0)

```

### anchoredPosition3D

[SVector](/docs/scripting/client-scripting-api-reference/types/svector.md) anchoredPosition3D {get; set; }

Example

**Lua**

```lua
Space.Host.ExecutingObject.RectTransform.anchoredPosition3D= Vector.New(0.7,0.6,0)

```

### anchoredPosition

[SVector](/docs/scripting/client-scripting-api-reference/types/svector.md) anchoredPosition {get; set; }

Example

**Lua**

```lua
Space.Host.ExecutingObject.RectTransform.anchoredPosition= Vector.New(0.7,0.6,0)

```

### sizeDelta

[SVector](/docs/scripting/client-scripting-api-reference/types/svector.md) sizeDelta {get; set; }

The size of this RectTransform relative to the distances between the anchors.

Example

**Lua**

```lua
Space.Host.ExecutingObject.RectTransform.sizeDelta= Vector.New(90,90,0)

```

### pivot

[SVector](/docs/scripting/client-scripting-api-reference/types/svector.md) pivot {get; set; }

The normalized position in this RectTransform that it rotates around.

Example

**Lua**

```lua
Space.Host.ExecutingObject.RectTransform.pivot= Vector.New(0.4,0.4,0)

```

### offsetMin

[SVector](/docs/scripting/client-scripting-api-reference/types/svector.md) offsetMin {get; set; }

The offset of the lower left corner of the rectangle relative to the lower left anchor.

Example

**Lua**

```lua
Space.Host.ExecutingObject.RectTransform.offsetMin= Vector.New(-50,-50,0)

```

### offsetMax

[SVector](/docs/scripting/client-scripting-api-reference/types/svector.md) offsetMax {get; set; }

The offset of the upper right corner of the rectangle relative to the upper right anchor.

Example

**Lua**

```lua
Space.Host.ExecutingObject.RectTransform.offsetMax= Vector.New(50,50,0)

```

### GameObject

[SGameObject](/docs/scripting/client-scripting-api-reference/types/sgameobject.md) GameObject {get; }

Example

**Lua**

```lua
theGameObject = Space.Host.ExecutingObject.RectTransform.GameObject

```
