Skip to content

AddComponent Order bug #49

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;

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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