- Home /
How to use shared material as my material
I am trying to create the prefabs from runtime in script and it seems like each prefab is using each instance of the original prefab and drawcalls become extremely dangerous. I tried to set the shared material as my main material as follow but it doesn't work... How can I setup the material to use it's shared one when doing realtime creation of the prefabs..
button.renderer.material.CopyPropertiesFromMaterial(button.renderer.sharedMaterial);
button.renderer.material = button.renderer.sharedMaterial;
They both doesn't work for me.. :(
Your answer
![](https://koobas.hobune.stream/wayback/20220612145017im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Changes done in prefab script get applied to all instances of that prefab. 0 Answers
Prefabs losing Material connections after re-opening scenes. Bug? 3 Answers
Material doesn't have a color property '_Color' 4 Answers
Changing two different objects renderer colour 1 Answer
material/textures not showing on editor 0 Answers