how to make chess board

Hi
Can everyone tell me how can i make chess board…? can you give me simple code to make chess board.
i am new to unity…? or can you tell me step to create chess board…

thank

You don’t “combine cube and meshes” a cube contains a mesh (the mesh is what makes up the cube ;)).

I would check out this post:

Unity Learning Resources

And also, have a look at unity’s FPS and platformer tutorials, they are very detailed and walk you through a lot of core elements of unity.

Also, it sounds like you need to learn a bit more about the 3d modelling side of things (coming from the quote at the start of this answer). I would suggest 3dbuzz.com for this. Altho, if you type “3dsmax tutorial” or “maya tutorial” in google, you will get some good results. Also, it depends what 3d package you have, if you don’t. Do some research on the ones available and take your pick.

Altho you don’t realise it, you have summarised many questions into 1, unanswerable, vague question. Once you learn more, you will come across specific questions that people can directly answer to help you. You have to help yourself in the meantime.

@DaveA Syclamoth actually said “I can’t really answer the question” :wink:

Technically, neither can i. But i have attempted to point him in the right direction so that he can answer his questions himself.

Try this one:

  1. Create prefabs 1x1x 0.3height for the white and black pieces;
  2. Create an C# script and use the code bellow. If your code name is CreateBoard, just copy and paste bellow the class brackets;
  3. Create an empty GameObject in the Hierarchy and drag the code to it;
  4. In the array, use 1 for one board style or more according. Drag the white tile to the tileswhite array. Drag the black tile to the tilesBlack array. I’ve created an array in case you need to use diferente tile materials, but if you don’t, remove the from the GameObject tilesWhite and tilesWhite;
  5. I hope this helps you;

public class CreateBoard : MonoBehaviour
{
public GameObject tilesWhite; //If use one board design, remove the array.
public GameObject tilesBlack;

int[] boardTiles = {1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1};
public int tilesType = 0; //Type of material of the tiles, fed in the tilesWhite/Black array;

void Start()
{
    for(int r=0; r < 8; r++)
    {  
        for(int c=0; c < 8; c++)
        {
            if(boardTiles[r * 8 + c] ==0)
            {
                Vector3 pos = new Vector3(r, 0, c);
                GameObject tile = Instantiate(tilesWhite[tilesType], pos, Quaternion.identity);                
            }else
            {
                Vector3 pos = new Vector3(r, 0, c);
                GameObject tile = Instantiate(tilesBlack[tilesType], pos, Quaternion.identity);                   
            }
        }           
      
    }

}

}

Try this. In the inspector you will only need to set the number of row and collums you want for your board and the materials for each square:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CreateBoard : MonoBehaviour {
public GameObject Square0;
public GameObject Square1;
public int width;
public int height;
void Start() {
      for(int r=0; r < width; r++)
     {for(int c=0; c < height; c++)
         {  if((r+c)%2==0){Instantiate(Square0,new Vector3(r, 0, c),Quaternion.identity);} else
            if((r+c)%2==1){Instantiate(Square1,new Vector3(r, 0, c),Quaternion.identity);}            
         }          
    }
  }
}