Home > other >  Unity add ContentSizeFitter component to get the UI size problem
Unity add ContentSizeFitter component to get the UI size problem

Time:09-27

Unity added Content Size Fitter components after get to component Size
Like me a background background here are a few pictures Zhang Zi then on the background to add a Horzontal Layout components and
After ConTentSizeFitter components and then obtain the background image size have get size width of 0 with preferred width and sizeDetle get is 0

CodePudding user response:

Your background anchor point set is wrong?

CodePudding user response:

reference 1st floor with the scholar's reply:
your background anchor point set is wrong?


There are any right or wrong about anchor anchor setting should not be based on demand to set up?

CodePudding user response:

OntentSizeFitter use Preferred Size to set the RectTransform cannot take effect immediately, will have to wait for a frame, so I can call before get Size UI. LayoutRebuilder. ForceRebuildLayoutImmediate this method
  • Related