How do You make_unique in code ?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Inces

Couldn’t find it in Help by search.
I work with scripts now instead of scenes, and thats the problem now. I want to change shaders param, but every mesh using this material also changes this param. Sollution in editor is simple - make unique. How can I do this by code , or is there other way around ?

:bust_in_silhouette: Reply From: skysphr

Any Resource type can be copied using its duplicate() function. Duplicating the material and assigning it to your node is essentially what “make unique” does.