Merge two gameobjects and create a new one unity2D!
Hello everyone. I'm making a game like 2048: shoot and merge. it's a little different than the normal 2048 and that's why I can't find any help anywhere. I designed the game in a way that is will instantiate tiles and send them up but, I don't know how can I merge them! this is the code i that I have right now and it gives me a log but, I don't know how can I manage to destroy it and instantiate the tile with the higher number just once.
 public class OneTile : MonoBehaviour
 {
     public int timevalue;
     public bool mergeTile;
     private void OnCollisionEnter2D(Collision2D collision)
     {
         if(collision.gameObject.tag== this.gameObject.tag)
         {
             Debug.Log("Merge!")
         }
     }
 
 }
 
              Your answer
 
             Follow this Question
Related Questions
Unity 5 How to destroy Enemy and not Ground in C# 0 Answers
How do you detect a mouse button click on a Game Object? C# 2 Answers
Unity 2D sorting item by color 0 Answers
create object on raycast collision that follows raycast. 0 Answers
2D: Destroy object with dynamic collider after exiting object with static collider 1 Answer