Z
Z
Zimaell2020-05-13 13:13:10
Unity
Zimaell, 2020-05-13 13:13:10

How to correctly set the dimensions of the camera?

I'm trying to build a grid on the stage (andriod), it turns out that
5ebbc6483404d651749369.jpeg
How to build a grid so that the camera is in the center of the grid, while moving the camera does not go beyond the grid?
My script is like this

public class Cells : MonoBehaviour{
    public GameObject Cell;
    const float SizeW  = 1f;
    const float SizeH  = 1f;
    public int WidthTable  = 10;
    public int HeightTable = 10;
    void Start(){
        for (int y = 0; y < HeightTable; y++){
            for (int x = 0; x < WidthTable; x++){
                Vector2 pos = new Vector2 (y * SizeW, x * SizeH);
                GameObject cell = Instantiate (Cell, pos, Quaternion.identity) as GameObject;
                }
            }
        }
    }

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question