title: Trying to make a simple Tag game in unity
body: <p>I've been trying to make the code for this idea and I just can't get it. Basically when a tagged player collides with a non tagged player, the roles turn and their colors change. This is my current code. there's a lot of mistakes :</p>
  <pre><code>public class Tag : MonoBehaviour
  {
      public Material[] material;
      Renderer rend;
      [SerializeField]
      string strTag;
      bool isTagged;
  
      private void OnCollisionEnter(Collision col)
      {
          if (col.gameObject.tag == strTag)
          {
             
            if(rend.sharedMaterial = material[0] &amp;&amp; isTagged == true)
               rend.sharedMaterial = material[1];
               isTagged= false;
  
  
            if(rend.sharedMaterial = material[1] &amp;&amp; isTagged = false)
               rend.sharedMaterial = material[0];
               isTagged= true;
          }  
  
      }
       private void OnCollisionExit (Collision col)
       {   
          if(col.gameObject.tag == strTag)
           {
          null;
           }
       }
  
      void Start()
      {
          rend = GetComponent&lt;Renderer&gt;();
          rend.enabled = true;
          rend.sharedMaterial = material[1];    
      }
  
  }
  </code></pre>