Material vs. SharedMaterial - difference in SETTING?

Just checking since I can’t seem to find a definitive answer.

The difference between GETTING material vs sharedMaterial is obvious - the former creates a copy, the latter references the asset.

Is there any difference at all when SETTING / assigning the material? Like,

public Material materialAsset;
public MeshRenderer meshRendererA;
public MeshRenderer meshRendererB;
void Start()
    // assign material to renderer A 
    meshRendererA.material = materialAsset;

    // and now assign it to renderer B 
    meshRendererB.sharedMaterial = materialAsset;

Will there be any difference between the two?

Away from my work computer atm, hence unable to check myself.


No, there is no difference. Both properties call the same internal method SetMaterial. Though their getters use different methods. All those internal methods are implemented in native code.

When setting the material you should use <Renderer>().material since that creates a new version of the prefab.
Using <Renderer>().sharedMaterial modifies the GameObject itself and updates the prefabs used material.

You can read about it here: Unity - Scripting API: Renderer.sharedMaterial
and here: Unity - Scripting API: Renderer.material