I’ve a number of parts inside a verticalLayoutGroup. To raised visualize which one is chosen, I want to scale all different parts to 75% of their measurement and maintain the present one as it’s.
This works so long as the component doesn’t comprise parts on their very own. (The darker shade is about concurrently the scaling and works, however I would like to get the scaling working as effectively)
When including parts to the present chosen line, all the pieces remains to be alright.
However as quickly as one other line will get chosen and the scaling applies, the place for the previous chosen line is wrong.
If the road will get chosen once more, it appears to be like right once more. The problem I want to get fastened is when the it will get scaled down and it shouldn’t be moved to the proper when it has objects by itself.
Every line has this code on it and a button as a set off (mustn’t trigger a difficulty), the code is decreased to the naked minimal.
public class UIDecisionLine: MonoBehaviour {
personal Vector3 smallScale = new Vector3(0.75f, 0.75f, 0.75f);
public void SetSelected() {
background.shade = Colour.burlywood;
remodel.localScale = Vector3.one;
}
public void SetDeselected() {
background.shade = Colour.white;
remodel.localScale = smallScale;
}
}
The code is known as from a mum or dad method up that holds all strains. They get first all deactivated earlier than one will get activated.
public void SelectRuleLine(GameObject selectedLine) {
foreach (var tempGo in allRuleLines) {
tempGo.GetComponent<UIDecisionLine>().SetDeselected();
}
currentlySelectedGO = selectedLine;
UIDecisionLine uiDecisionLine = currentlySelectedGO.GetComponent<UIDecisionLine>();
uiDecisionLine.SetSelected();
}
It’s a primary setup (their is a mum or dad scrollView which mustn’t trigger the problem)


Every of the choice strains has a gridLayout and people comprise the smaller icons afterwards.
The icons are primary photos from a prefab and a button.
Making an attempt totally different mixtures within the verticalLayoutgroup both place the road extra to the left (off container), scale the scroll all the way in which to the proper or do nothing in any respect.
Calling LayoutRebuilder.ForceRebuildLayoutImmediate on Content material was not doing something. (After each choose/ deselect or solely after each).
Altering childAlignment on Content material was not doing something to repair it.
The present Unity model is 6000.2.13f1







