I have a gameobject within it there is a TextMeshPro gameobject. I used to change the material of TMP in awake() to customize it according to some criteria(worked fine 100%). Recently after an issue with unity I exported all stuff as pkgs then imported them one by one to a new project overall works fine except new feature. I realised that the this gameobject plays always its animation with the default material.
ChokoPiece.GetChild(0).GetChild(2).gameObject.GetComponent<MeshRenderer>().material = GetTextMat(index);
this code works fine I can check it and it changes the material
but when the collision happen the TMP material reverts to the default one in the prefab and play animation after!!??.
one thing I noticed is that if I leave the TNP active = true animation plays with correct material. I tried keep it active then set it to inactive in script after setUp(same issue)
Can anyone direct me where is the problem plz? I tried using renderer material/sharedMaterial, meshrenderer material/sharedMaterial, and TMP material property no luck. It updates in awake method then reverts to default in OntriggerEnter event handle