How to force a material to update after changing its attributes

Hello all,
Perhaps you can help me.

I developed an Editor script to change parameters of materials according to an XML file; as part of my import workflow.

So, I clone (instanciate) a template Material object from my assets and set all parameters using “SetTexture” and “SetColor”.
Once I am done editing with my script, the material doesn’t seem to react properly. In the SCENE and small thumbnail I have still the old aspect. Perhaps textures are not evaluated properly…

Even reloading the Project fully doesn’t do anything. I have to select it in a inspector view as the only way to solve my problem.

Then I have to select it in the inspector to force it to suddenly update and displays correctly both in the SCENE view and the small thumbnail from the inspector !
Likewise, when I select a gameObject with a Mesh, if I unfold the small material view from the inspector, the update fires and it displays correctly. each materaiol have to be “touched” this way.

  • How can I absolutely force Unity to reevaluate a material ?
  • If not possible, how can I make Unity display all my current materials in the inspector view in a fast sequence to force the update anyway ?

Any AssetDatabase.Refresh() ; EditorUtility.SetDirty(ma) ; AssetDatabase.ImportAsset(…) combination i tired didn’t change anything. Perhaps the shader stays uncompiled or optimized from the improper parameter set that was used before I changed its configuration ?

Hope I am clear, sorry if not

Thanks a lot and best regards

I found, when using the standard shader inputs must be activated.