I hope you have an idea how I can solve my problem. I have a huge box which contains some little boxes(in 2D)(picture 1).Now I want to scale down the bix box and move them into the bottom right corner(picture 2). The small (child) boxes should be scale down correctly with the big box. To do that I simply animate Anchored Position and Size Delta for the big box. The problem is the small boxes don’t scale down correctly. They are to big when the box is in the corner. Where should I have my anchors for the small boxes ? Or is it another problem ?
Are we talking about uGUI UI elements? If so, I think you should ask this in UI area - it is the right place for such questions and you are more likely to get answers.
Anyway - you should think UI anchor(s) as a set of pins - if you haven’t split it, object will only retain its position relative to that point when parent is moved or resized.
If you have split the anchor, you can place each four marker pins to corners of a RT - this way you pin the RT to its parent RT from these points, and it will expand like rubber sheet in both x and y axis.
Then again, if you split the anchor only in one axis, and place the anchors in one edge of RT, then only that axis will stretch, while other corners not pinned by anchors will move.
“Now I want to scale down the bix box and move”
Seems like you don’t have your terminology quite right - The simplest way is to scale the parent panel, instead of resizing it - and your image seems to indicate you want to do that… it will result in exactly what you show in your sketch. However - if your resize your panel it will do what you described.
@eses thank you very much for your fast answer. I think you are right. This boxes are panels with a Canvas Render,Image and RectTransform.So maybe it should be moved to the UI area. Thank you very much for the informations. So at the moment I have the pins for every little box on the corners of every little box. Now I am a bit confused you write I should scale the parent panel( thats what I do at the moment with DeltaSize.Or do you mean something different?).And in your last sentence you write I should resize it. What is the different between resize and scale? Scale is just to make it smaller and bigger and keep the shape, and resize is flexible in changing shape and scale ,right?
Ah sorry you mean with “However - if your resize your panel it will do what you described.” the wrong behaviour,right? Not that this is the answer to my question. I tried it first with scaling but then it looks not really good.But maybe I have to double check if I want a solution with scaling.Where should be the pins for the small boxes?Connected to the corners of the big box?
“I tried it first with scaling but then it looks not really good.”
Define not looking good! You are going get scaling in bitmaps and tiled sprites you use in UI for sure… and of course, text elements will scale too.
“Where should be the pins for the small boxes?Connected to the corners of the big box?”
It is pretty hard to explain in more detail what happens, I already explained the key things you need to know, and how the anchors work. There isn’t much more to it. These are so basic things that I can only recommend you watch suitable videos - all of which are available also in YouTube / Unity’s channel, all the anchor behaviors are explained in the videos.
mhm I understand. I think I know how it works with the pins because I made some tests and everything was fine.Thats why I am surprised that in this case it is not working. For example if I simply put the pins from the small boxes to the corners of the big box. It is scaling the little boxes with the same values like the big box, which is of course to much.Thats what I meant with I need the proper ratio .I guess I missed something in the explanation for the anchors.I will try to find more informations about that.What I mean with it is not looking good is. I wanna try to make an animation for the big box that look likes the box opens from the bottom corner and scaled to the full screen. I didn’t get the result with simply scaling the box. But maybe it will work if I move the pivot of the big box to the bottom right and then scale it. I will try this at home.