I wanna try to do a game like tetris but the game logic is like that
-I want to match colors when they collide each of them

-And i have 6 different blocks object that have different colors. I want to choose of them randomly and i want to merge the two blocks together at the top of screen
But I do not know how to select 6 different blocks of different colors as random and link them to each other at the top.
Are there suggestions for me?
Esteem
2
can you give us more info?
what does link mean in this context? slap them together at the meeting side and make them one color?
if you have those 6 blocks as prefabs, you can do
int randomBlockIndex = Random.Range(1, 6);
and then use the random index to instantiate random block. I am not sure what you mean by linking them together though
I have a NET Framework problem on my laptop therefore it doesnt open exactly at the line that failed but i took ss for all codes for you.
When i was worked the code,game is opening but there is no spawn or something happens.
By the way , thanks for all helps 
My codes are there also
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
public class BlocksManager : MonoBehaviour {
// farklı renklere sahip blokları alma
public List<GameObject> blockPrefabs = new List<GameObject>();
// blokların spawnlanma frekansları
public float spawnFrequency = 2f;
// blokların farklı renklere zorlama
public bool forceDifferentColors = false;
// blokların spawnlanma pozisyonları
public Vector3 spawnPosition;
private GameObject fallingBlocks1;
private GameObject fallingBlocks2;
private float timer;
// random numara üretiyor
private System.Random prng;
private void Start() {
if (blockPrefabs.Count == 0) {
throw new System.Exception("No block types found in the blocks list.");
}
}
private void Update() {
timer += Time.deltaTime;
if (timer >= spawnFrequency) {
/*
Zamanlayıcıyı 0'a ayarlamak yerine,
zamanlayıcıyı ortaya çıkma sıklığına göre düşürüyoruz
çünkü bu şekilde spawnlama periyodunu daha güzel düzenleriz.
*/
timer -= spawnFrequency;
CreateNewBlocks();
}
}
private void CreateNewBlocks() {
// 0 sabit ama blocksPrefabs.Count sayı olarak değişir.
int randomBlock1 = prng.Next(0, blockPrefabs.Count);
int randomBlock2 = prng.Next(0, blockPrefabs.Count);
// eğer 2.bloğun farklı renk olmasını zorlamak istiyorsam
// ve 1 den fazla blok prefabi varsa bu formül
if (forceDifferentColors && blockPrefabs.Count > 1) {
while (randomBlock1 == randomBlock2) {
randomBlock2 = prng.Next(0, blockPrefabs.Count);
}
}
Vector3 position1 = spawnPosition += Vector3.left / 2f;
Vector3 position2 = spawnPosition += Vector3.right / 2f;
//fallingBlocks1 =Instantiate(blockPrefabs[randomBlock1], position1, Quaternion.identity);
// fallingBlocks2 =Instantiate(blockPrefabs[randomBlock2], position2, Quaternion.identity);
Instantiate(blockPrefabs[randomBlock1], position1, Quaternion.identity, transform);
Instantiate(blockPrefabs[randomBlock2], position2, Quaternion.identity, transform);
}
}