Reputation: 13
is there any way to change component setting of Constraint: "Fixed Row Count", by script, and then assigning constraint count to 1?
Upvotes: 1
Views: 7768
Reputation: 16277
Create a script, .e.g. test.cs, add/attach this script to the same game object as the GridLayoutGroup:
public class test : MonoBehaviour {
GridLayoutGroup glg;
void Start () {
glg = gameObject.GetComponent<GridLayoutGroup>();
Debug.Log(glg);
glg.constraint = GridLayoutGroup.Constraint.FixedRowCount; //**
glg.constraintCount = 1; //**
}
}
Run the game, you will see this is automatically set to 1.
Upvotes: 4