Skip to content

AddComponent Order bug #49

@aymen157

Description

@aymen157

This code leads to proper flexbox

var _text = GameObject.AddComponent<Text>();
var fitter = GameObject.AddComponent<ContentSizeFitter>();
fitter.verticalFit = fitter.horizontalFit = ContentSizeFitter.FitMode.PreferredSize;
this.GameObject.AddComponent<FlexLayout>(); // <----- added after creating the text.

this code leads to nothing. flexbox has no effect on the _text and its siblings.

this.GameObject.AddComponent<FlexLayout>(); // <----- added before creating the text.
var _text = GameObject.AddComponent<Text>();
var fitter = GameObject.AddComponent<ContentSizeFitter>();
fitter.verticalFit = fitter.horizontalFit = ContentSizeFitter.FitMode.PreferredSize;

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