title: How do I change my variable in this script?
body: <p>I feel like my code should be really simple for me to understand, but I keep coming up with the same problem.
  float contactWithPlayer = 1;</p>
  <pre><code>   using System.Collections;
  using System.Collections.Generic;
  using UnityEngine;
  
  public class SheildMovement : MonoBehaviour
  {
      // Start is called before the first frame update
      void Start()
      {
          sizeRandomised = Random.Range(playerModSize, playerModSize);
          transform.localScale = new Vector3(sizeRandomised, sizeRandomised, sizeRandomised);
          sideDrift = Random.Range(playerModSideDrift * -1 - 1, playerModSideDrift + 1);
          downSpeed = Random.Range(playerModDownSpeed, playerModDownSpeed + 2);
      }
      //Global Variables
  
      public int playerModSideDrift;
      public int playerModDownSpeed;
      public float playerModSize;
      float sizeRandomised;
  
      float sideDrift;
      float downSpeed;
  
      float contactWithPlayer = 1;
  
  
     
      // Update is called once per frame
      void Update()
      {
          Debug.Log(contactWithPlayer);
          Vector3 cloneStats = new Vector3(sideDrift * .01f, -downSpeed * .01f, 0);
          transform.position += cloneStats;
  
  
          if (transform.position.y &lt; -10)
          {
              Destroy(gameObject);
          }
      }
  
  
      private void OnTriggerEnter2D(Collider2D collision)
      {
          if (collision.tag == &quot;Player&quot;)
          {
              contactWithPlayer = 2;
              Destroy(gameObject);
          }
      }
  }
  </code></pre>
  <p>The problem is: I am trying to get the update method to print out contact with Player = 2, but it keeps saying 1.</p>