So I'm trying to make a Scrollviewer and inside that will be aload of boxes stacked on top of each other (the boxes have information in them - like the boxes in this screenshot here but they will always be the same size).

My problem is that whenever (in Unity's UI) I set where the Text UIs (in-game) should be, they will revert to some random place whenever I start the game.

For example: I set the X: 0 Y: 50, start the game changes are made and it looks right. But when I exit game mode the X: Some random number between 0-1000 Y: Also the same, some random number between 0-100.

Anyone know why this is happening?

  • \$\begingroup\$ I would recommend you re-read through your question, and attempt to format it better; its difficult to tell what your trying to say. But yes, if you make changes in play mode, they do not save. So any changes made while your playing will not remain when you exit from play mode. \$\endgroup\$ – Gnemlock Dec 4 '16 at 7:10
  • \$\begingroup\$ Yeah I know its really badly worded, but I cant describe it in words, other than the settings dont change when I change the stretch settings. \$\endgroup\$ – Lachlan Mather Dec 4 '16 at 7:18
  • \$\begingroup\$ perhaps take some screenshots or record your screen as a GIF to help convey your problem \$\endgroup\$ – Gnemlock Dec 4 '16 at 7:43

First of all, to achieve something like Clash of Clans chat, you need something to procedurally adjust rect-transforms of that boxes. That is how it works.

But if you still want to adjust them manually and want it to persist:

It seems like you have a layout component or another script controlling rect transforms of your scroll rect elements. Make sure none of the following are attached to ScrollRect or the boxes:

  • Layout Element

  • Content Size Fitter

  • Aspect Ratio Fitter

  • Horizontal Layout Group

  • Vertical Layout Group

  • Grid Layout Group

These components I listed are automatic layout components, they adjust layout of descending UI objects depending on your settings. So they overwrite your manual settings.

If you make sure none of these exist but problem is still present, then you must have a script of your own controlling rect transforms, find and delete it.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.