Creating a Component that Drives Other Components

I noticed that when using either a horizontal or vertical layout group to design a ui element that there is an option to allow the rect transform of a parent object to drive the rect transform(s) of its children. I am designing a custom user interface and I need more flexibility than the default options for these components provide; how can i create a component or script of my own that will offer the same functionality?

Your question is very open-ended. If you try something, and then ask for help with specific problems, you will get more replies.

There isnt really any info on what your trying to achieve in that post, its a super open ended question and unlikely to get many decent replies.

If what your asking is what I think your asking, you just need to reference the other component inside of the current component and use its values to drive its behaviour, which is very simple, just have those values set as public or provide a public accessor method and your good to go. Is this what your asking?

@bgulanowski @MadeFromPolygons_1
I approached this topic somewhat generically because I was finding it hard to describe what I needed; I am creating a ui prefab for in-game command windows that will be used to navigate through the various menu screens, etc. the prefab has multiple children which use various components to get the desired appearance, but right now I have to set all of the children’s rect transform data manually, which is not an efficient way to work. more importantly, it does not promote the concept of modularity the way I have in mind; I want to use this prefab to build all of the windows which will appear in the game, which will vary in design, so some flexibility is desired.

specifically, I want the parent’s rect transform to drive the rect transform(s) of its children so that when using the base prefab to design a new window with a unique use-case I don’t have to spend a lot of time changing values in the inspector. I referenced the layout group’s in the initial post because they have the functionality I would like to incorporate into my windows (set the width and height once, and all children will have the same value).

does this help to clear up any of the confusion?