어떤 오브젝트를 터치했는지 알아내서 처리하는 코드
void Update()
{
if (Input.GetMouseButton(0))
{
Vector2 touchPos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
RaycastHit2D hitInformation = Physics2D.Raycast(touchPos, Camera.main.transform.forward);
if (hitInformation.collider != null)
{
//We should have hit something with a 2D Physics collider!
GameObject touchedObject = hitInformation.transform.gameObject;
//touchedObject should be the object someone touched.
...