How the Check Works
This check examines individual GameObject
s within your UI hierarchy. For each GameObject
, it checks if it contains a ContentSizeFitter
or an AspectRatioFitter
. If such components are present, the check proceeds to verify their parent relationships.
The check looks for the following conditions:
- The presence of
ContentSizeFitter
orAspectRatioFitter
components. - Whether the
GameObject
has anILayoutIgnorer
component and is set to ignore layout. - Whether the
GameObject
is a child of aRectTransform
parent with an enabledILayoutGroup
component (such as aLayoutGroup
).
If all these conditions are met, it indicates that a ContentSizeFitter
or AspectRatioFitter
is incorrectly nested within a LayoutGroup
. Such nesting can lead to unexpected UI behavior, and the check logs it as an issue.
When to Use This Check
- UI Hierarchy Cleanup: Ensure that your UI hierarchy is correctly structured to avoid unexpected layout issues.
- Prevent Layout Bugs: Detect and rectify incorrectly nested
ContentSizeFitters
orAspectRatioFitters
withinLayoutGroups
to prevent layout bugs. - UI Best Practices: Promote adherence to UI best practices by identifying and addressing problematic UI configurations.
How to Use the Check
- Configuration: No specific configuration is needed for this check.
- Performing Checks: Call the
PerformCheck(GameObject gameObject)
method on theGameObject
you want to examine. If the check detects incorrectly nestedContentSizeFitters
orAspectRatioFitters
withinLayoutGroups
, it logs them as issues.
Methods
PerformCheck(GameObject gameObject)
: Performs the check on the specifiedGameObject
to identify incorrectly nestedContentSizeFitters
orAspectRatioFitters
withinLayoutGroups
.
Attributes
longDescription
: Provides a description of what this check does.