I am working on a Match-3 game. I dynamically create a grid of prefabs (the Grid gameobject) within a Panel. For now, I would like to do the following. Please advise as to the best practice.
1. Anchor the panel to the UIRoot, so that size of the panel changes proportionally for mobile.
2. Base the size of the Grid on the size of the Panel as determined in 1. Currently I am hard-coding the cell size as follows. I want it to be based on the Panel size dynamically.
instance.transform.localPosition = new Vector3(x * cellWidth, y * -cellHeight, 0f);
3. Position the Grid starting at the upper left hand corner of the Panel. Basically I want the grid to resize dynamically based on the panel size.
This is my hierarchy:
Main Camera
UIRoot
Camera
Panel
Grid
Thanks in advance