title: Strange If/Else Behavior
body: <p><strong>Context</strong></p>
  
  <p>I am making a mobile game in which the player is required to touch objects in a specified order. The correct order is determined in a List called clickOrder. To determine the current object the player is supposed to click, currClickIndex is used.</p>
  
  <p><strong>Problem</strong></p>
  
  <p>When touching a correct object, the debug text will display "Correct" for a split second, and will then immediately change to "Wrong." What I am unsure about is why both the if and else blocks are executed when only touching a single object.</p>
  
  <p><strong>Code</strong></p>
  
  <pre><code>void Update()
  {
      if (Input.touchCount == 1)
      {
          if (this.enabled)
          {
              Vector2 worldPoint = Camera.main.ScreenToWorldPoint(Input.mousePosition);
              RaycastHit2D hit = Physics2D.Raycast(worldPoint, Vector2.zero);
  
              if (hit != null &amp;&amp; hit.collider != null)
              {
                  // check if the touched object is the correct one
                  if (hit.collider.gameObject == clickOrder[MyData.currClickIndex])
                  {
                      debug.text = "Correct";
                      MyData.currClickIndex++;
                  }
                  else
                  {
                      debug.text = "Wrong";
                  }
              }
          }
      }
  }
  </code></pre>