- Home /
Question by
nyonge · Apr 05 at 06:02 AM ·
materialmaterialsmeshrenderersharedmaterialsetters
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;
private 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.
Thanks!
Comment
Answer by Bunny83 · Apr 05 at 07:06 AM
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.