Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.

    Read our full announcement for more information and let us know if you have any questions.

Question Error CS1002

Discussion in 'Getting Started' started by ReasonableChoice, Apr 28, 2024.

  1. ReasonableChoice


    Apr 26, 2024
    I was following a tutorial but when I finished putting the code I got an error and I don't know what's wrong.

    public class Chessboard : MonoBehaviour
    private const int TILE_COUNT_X = 8;
    private const int TILE_COUNT_Y = 8;
    private GameObject[,] tiles;

    private void Awake()
    GenerateAllTiles(1, TILE_COUNT_X, TILE_COUNT_Y);

    private void GenerateAllTiles(float tileSize, int tileCountX, int tileCountY)
    tiles = New GameObject[tileCountX, tileCountY];
    for (int x = 0; x < tileCountX; x++)
    for (int y = 0; y < tileCountY; y++)
    tiles[x,y] = GenerateSingleTile(tileSize, x, y);
    private GameObject GenerateSingleTile(float tileSize, int x, int y)
    GameObject tileObject = new GameObject(string.Format("X:{0}, Y:{1}", x, y));
    tileObject.transform.parent = transform;

    return tileObject;

  2. Ryiah


    Oct 11, 2012
    Accidental capitalization of
    . Your IDE should have hightlighted this with a red squiggly line.
    ReasonableChoice likes this.
  3. bugfinders


    Jul 5, 2018
    Please also learn to use the code tags this forum provides to make your code be more readable