Generation

generate functionTue, 03 Jan 2023

how to make a match 3 game where 3 objects of the same kind are touching, can be clicked and destroyed.

using UnityEngine; using System.Collections; public class DestroyBlock : MonoBehaviour { public GameObject destroyableBlock; public GameObject destroyableBlock2; public GameObject destroyableBlock3; public void OnMouseDown() { if(destroyableBlock == null || destroyableBlock2 == null || destroyableBlock3 == null) { return; } else { Destroy(destroyableBlock); Destroy(destroyableBlock2); Destroy(destroyableBlock3); } } }

Questions about programming?Chat with your personal AI assistant