GameObject material reverts to prefab default at after script modification @ runtime

Hi everyone,
I have a prefab that contains a TextMeshPro gameobject, the parent gameobject has a setup script that modifies the material of the TMPro child gameobject (script works fine). Actually when the OnTriggerEnter event occurs the TMPro gameobject is activated and animation plays with the default material on the TMPro gameobject.

if I keep the the TMPro gameobject active(not suitable for the game) the animation plays as expected
if keep it active during the setup then deactivate it same issue
before upgrade 2019.4.21 the animation played correctly.
Can anyone point me to where the issue/error is. I posted on answers site also TextMeshPro meterial reverts to preefab default after collision - Questions & Answers - Unity Discussions

Here is My solution after some research, I found a TMP ugui issue that pointed out to my solution. in Unity 2019.4.20 and earlier I was using gameObject.GetComponent<Renderer>().sharedMaterial, it seems I have to use now gameObject.GetComponent<TextMeshPro>().fontMaterial even with the TMP object deactivated. the updated material is used as it was before same applies for Unity 2019.4.28