I wonder if I’m the only one with the following problem:
As far as I can tell if you use animated buttons the animations always affect all parenting objects when they also have a button component, which is very unfortunate as you need to parent the game objects if you want to anchor them. (Which you need to do when buttons change their size according to the localized string). This happens with Color Tint as well as with custom button animations per animator.
Is their a way to either anchor buttons to each other without parenting them or to change the buttons so they do not affect the parent objects?
Okay, I did some more digging and found out that it has actually nothing to do with the button component. The problem seems to be that the clickable area of UI elements is not only limited to the mesh of the UI but it includes all children as well.
Is their a way to deactivate that as it de facto means that you cannot anchor buttons to each other as the parenting button will always include the clickable areas of all children.
A canvas group may help here. But I think it’s actually a design issue.
In general you don’t need to have GameObjects as children of buttons. You can make them siblings and avoid all of this. If needed you can use an empty GameObject for grouping and sizing.
Thanks for the answer. I would be interested how you would solve the following situation or design it differently.
I have three buttons in a horizontal row which only consists of labels. The size of the labels can change depending on the localization. But I always want to have the same padding between them.
I thought the correct way to do this ( and which works except the clickable area problem) is to anchor these buttons to each other and use a content fitter script so the size of the buttons match the string inside. But in order to anchor them to each other you need (?) to children them - at least with the new UI. (I had the same construction working with NGUI by the way) Putting empty gameobjects between them doesn’t change the clickable area problem.