title: Boolean will not change no matter what
body: <pre><code> void OnCollisionEnter2D (Collision2D col)
   {
   if (col.gameObject.tag == "Enemy1" ) {
   enemyContact = true;
   Debug.Log ("shot has collided with tagged enemy");
   }
   }
  </code></pre>
  
  <p>The problem is that I know the collision is successful in that the debug shows up, but enemy contact will NOT turn true. Once it is true the enemy dies, and if I set it to true in Awake, this is proved to be true.</p>
  
  <p>But how, can the the program be getting to the debug but still refuse to turn the Boolean to true???</p>
  
  <p>I must be losing my mind.</p>
  
  <p>I've also tried:</p>
  
  <pre><code> void OnTriggerEnter2D(Collider2D other)
   {
       if (other.tag == "Enemy1")
       {
           enemyContact = true;
           Debug.Log ("trigger enter worked");
       }
   }
  </code></pre>
  
  <p>The variable will not change. Again, even though the debug log shows up on contact, the variable will not change.</p>
  
  <p>I have also tried:</p>
  
  <pre><code> void OnTriggerEnter2D(Collider2D CollisionCheck)
   {
       if (CollisionCheck.gameObject.tag == "Enemy1") {
           Debug.Log ("shot has collided with tagged enemy");
  
           enemyContact = true;
       }
   }
  </code></pre>
  
  <p>The variable will not change to true. No matter what. 
  Even tried:</p>
  
  <pre><code>void OnCollisionEnter2D (Collision2D col)
       {
           if (col.gameObject.tag == "Enemy1" ) {
  
               Debug.Log ("shot has collided with tagged enemy");
               if (enemyContact == false){
                   enemyContactFunction();
  
           }    
       }
  
   void enemyContactFunction(){
           enemyContact = true;
       }
  </code></pre>
  
  <p>The debug again goes off but the function will not run, and the variable stays unchanged. The variable is public and I can watch it. I don't know what else to add. Here is the entire script:</p>
  
  <pre><code>using UnityEngine;
  using System.Collections;
  
  public class ShotScript : MonoBehaviour {
  public Player pScript;
  public Vector2 velocityRight = new Vector2(5, 0);
  public Vector2 velocityLeft = new Vector2(-5, 0);
  public Vector2 velocityUp = new Vector2(0, 5);
  public Vector2 velocityDown = new Vector2(0,-5);
  
  public Vector2 velocityupRight = new Vector2(5, 5);
  public Vector2 velocityupLeft = new Vector2(-5, 5);
  public Vector2 velocitydownRight = new Vector2(5,-5);
  public Vector2 velocitydownLeft = new Vector2(-5,-5);
  
  private Rigidbody2D shotRigid;
  
  
  
  public bool enemyContact = false;
  public bool enemyContactTrue = false;
  
  void Awake()
  {
      shotRigid = GetComponent&lt;Rigidbody2D&gt; ();
  
  }
  
  void Start()
  {
  
      //checking which direction player is facing to decide which way to shoot
      shotRigid = GetComponent&lt;Rigidbody2D&gt; ();
  
  }
  
  void enemyContactFunction(){
      enemyContact = true;
  }
  
  void OnCollisionEnter2D (Collision2D col)
  {
      if (col.gameObject.tag == "Enemy1" ) {
  
          Debug.Log ("shot has collided with tagged enemy");
          if (enemyContact == false){
              enemyContactFunction();
  
      }   
  }
  
  } }
  </code></pre>