Kizspy | Question: 43
(Choose 1 answer)
When implementing mouse dragging functionality in a Unity game, which combination of InputAction callbacks
and conditions would you use in your C# script?
A. Use OnMouseDrag(InputAction.CallbackContext context) and check if context.performed is true for
starting drag, and context.canceled for ending the drag.
B. Implement OnMouseDown() and OnMouseUp() methods, and calculate the drag distance in Update()
method.
C. Register callbacks for OnMouseDown(InputAction.CallbackContext context) and
OnMousePosition(InputAction.CallbackContext context), starting the drag on context.performed and tracking
the mouse position until the button is released.
D. Utilize OnLeftClick(InputAction.CallbackContext context) for detecting drag start, and track movement in
OnMouseMovement (InputAction.CallbackContext context) until context.canceled is true.