void ReleaseObject(Ray ray) { PickedObject = null; pickedDeltaValue = Vector2.zero; lastPosition = Vector2.zero; deltaPosition = Vector2.zero; RaycastHit2D targetInfo = Physics2D.Raycast(ray.origin, ray.direction * 1000.0f); if (targetInfo.collider != null) { if (targetInfo.collider.gameObject == controlTarget) { SpriteObject targetSController = controlTarget.GetComponent <SpriteObject>(); if (targetSController != null) { targetSController.OnClick(); } } } }