Why is the material switching back after collision?

I’m making a tile puzzle where you need to change all the tiles to a certain color and the way you change the color is to move the player over the tile. I have it set so that on each input the player is automatically moved into the center of a tile where I put a trigger. My goal is to have the tile change material each time the player enters a trigger, from corrupt material to pure material and back again each time the player triggers this script. For some reason though whenever the player enters the trigger the material changes to Pure for about 1 frame and then switches back to CorruptTileMat. The collision is only happening once so I’m not sure why its changing back each time rather than staying the new color. also no matter what material the tile is its automatically changed to CorruptTileMat, not sure why that is happening either.
I’m quite noob at coding so any help is appreciated! Here is the code I wrote.

using UnityEngine;
using System.Collections;

public class CorruptTile : MonoBehaviour {

public Material CorruptTileMat;
public Material Pure;
public GameObject CTile;
private bool Corrupted;

private void FixedUpdate()
{
    if (CTile.GetComponent<Renderer>().material = CorruptTileMat)
    {
        Corrupted = true;
    }
}

private void OnCollisionEnter(Collision collisionInfo)
{
    if (collisionInfo.collider.name == "Player")
    {

        if (Corrupted == true)
        {
            
            Debug.Log("Collision Detected");
            CTile.GetComponent<Renderer>().material = Pure;

        }

        else if (Corrupted == false)
        {
            Debug.Log("Collision Detected");
            CTile.GetComponent<Renderer>().material = CorruptTileMat;
        }

        

    }

    
}

void Update () {

	
}

}

if (CTile.GetComponent().material = CorruptTileMat)

A single = is assignment, so your FixedUpdate is setting the material, not testing it.

But it’s not clear to me why you’re doing this check in FixedUpdate anyway; why not set the flag in OnCollisionEnter, when it becomes corrupted? And in any case, FixedUpdate doesn’t look like the right place for it, since it’s not physics-related.