Hi everyone. So, I'm making a 2D mobile game. In order to move your player character you need to touch on a specific game object, let's call them "squares". I'm making a few squares with a tag (i.e "target"). What I need is a way to "capture" the game object in the touch position ( touchPosition = Camera.main.ScreenToWorldPoint (touch.position); ) and check if tag equals to target. How can I achieve this? Thanks and sorry for my english!
Code (CSharp): OnCollisionEnter2D(Collision2D col) { if(col.gameObject.tag == "Your Tag Here") } or you could Code (CSharp): private void Update() { if(touchPosition == gameObject.CompareTag("Your Tag Here")) } I think that might work.