Hi guys, i’ve run into an issue with a project i’m working on.
Everything is working great except one thing. I have a couple of UI objects as children of a big block of text; my issue is that those child objects don’t stay in their position when the aspect ratio changes.
Everything else stays as it should. I have panels with far more objects and everything stays where it should.
These couple objects don’t.
Does anyone have any tips on what to check?
Check the Anchors for child objects. I think they should be set along the top left corner, but try and see what works best.
@Zaflis thanks. you mean it’s own top left corner, or align it with the top left corner of the parent object?
Select all child objects, and then see in inspector. Top left was only a suggestion, i don’t know how it reacts with your scene. It could be the middle option works too? You propably don’t want to use the “stretch” versions, because they do just as you say, change their position as the aspect changes.
Yeah i know, it depends on the scenes and the setup. Still thanks though, It’s a suggestion i need to check.
@Zaflis Edit: Nope. i thought it did the trick but nope.
I’m now thinking that it has something to do with the canvas scaler.
When i resize the player window, the text gets re-aligned or something, as if i’m changing the kerning. Aspect ratio doesn’t change, yet the text inside the box goes wonky…
I just did a quick test with new project. Add some objects in their hierarchy, then stretch the aspect. Buttons stayed perfectly aligned with text. So i don’t know what you’ve done, the defaults work fine.
Text on buttons is find. It’s centering on the button which is the parent. The issue was that it was a big block of text that had the child. If you change the resolution, it would resize the text even slightly. But because it was so big, even a slight rearrangement would change the text, but not it’s container box. So the child wouldn’t rearrange its self.
(confused you yet? )
If you need more help, you can try uploading a simple example project to show it exactly. There is not much else i can tell, it’s pretty much all about changing the anchor properties of objects. Or 2 screenshots, before and after resize to show the effect.
Well i sort of hacked my way around the issue by dividing the big wall of text into smaller paragraphs that then went into their own boxes. So it kept the shivering to a minimum.