Skip to content

Dynamic TMP_Text width #41

@Michele-Santoni

Description

@Michele-Santoni

I tried to test the FlexLayout component when the length of the text of the TMP_Text can change.
The hierarchy is this:

  • Root
    • Text_1_Parent
      • Text_1
    • Text_2_Parent
      • Text_2

Every gameobject has a FlexLayout component attached and they are set like this:

[ Root ]
Image

[ both Text_*_Parent gameobjects ]
Image

[ both Text gameobjects ]
Image

As shown in the "Scroll View" smaple scene, I attached the ContextSizeFitter component (with the "Horizontal Fit" option set to "Preferred Size") to both the TMP_Text gameobjects and the result is this:
Image
p.s. the red box is the Root gameobject and the white boxes are the Text_*_Parent gameobjects.

When I'm trying to get this result instead:
Image

Am I missing something? Do I need to change the settings of my FlexLayout in a certain way?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions