Search Unity

mouse dragging

Discussion in 'Scripting' started by Winter18, Mar 13, 2019.

  1. Winter18

    Winter18

    Joined:
    Jan 7, 2019
    Posts:
    1
    How do we select multiple objects in game via mouse dragging. For example, I select (button down) a yellow colour ball and drag it across other yellow ball beside it, when 3 yellow ball or more is highlighted, it is then destroyed when it is released (button up). this is something like candy crush, minimal 3 balls to destroy it.
     
  2. Rivomist

    Rivomist

    Joined:
    Oct 1, 2016
    Posts:
    8
    If I understand you right, u can create a List<T> where T is yellow color ball class, while selecting a ball just add T to the list, and each time u select an object just check List size and if its > 3 do whatever you need.