Version: 2023.2
LanguageEnglish
  • C#

VisualElementExtensions.StretchToParentSize

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public static void StretchToParentSize(UIElements.VisualElement elem);

Parameters

elem The element to be aligned with its parent

Description

Aligns a VisualElement's left, top, right and bottom edges with the corresponding edges of its parent.

This method provides a way to set the following styles in one operation: - IStyle.position is set to Position.Absolute - IStyle.left is set to 0 - IStyle.top is set to 0 - IStyle.right is set to 0 - IStyle.bottom is set to 0