Why can't you copy a Material component?
Is there something special I have to do to be able to copy a material component? Changing tons and tons of shader values all at once is becoming tedious...
Do you mean in the editor? You can press Ctrl+D to duplicate a material there. Otherwise in script you'd have to make a deep copy.
Like cjdev said yo just can duplicate the $$anonymous$$aterial with Ctrl+D / strg+D. A material is a asset and not a component. It's more like a texture(asset) that lives in your project then then a script(component) that runs on your gameobject. The render component is just referencing it.
So a material is nothing more than a pre-configured shader, right?
A material is just a Unity component that points to the compiled shader code, any textures it relies on, and any external variables the shader defines. Basically the shader is the compiled code that gets run by the GPU and the material is what manages the rendering component on the CPU side.
Answer by paraself · Oct 06, 2015 at 03:58 AM
A Material is not a component, it's an asset. cjdev explained quite clearly. If you want to render objects with a single material and all of the object varies a bit in its shader values , consider using MaterialPropertyBlock to apply these values. By using MPB, you can render all of the objects with only one material assets and possibly benefiting from unity's batching optimization. http://docs.unity3d.com/ScriptReference/MaterialPropertyBlock.html
Answer by Wanzyee · Mar 04, 2016 at 09:29 AM
To duplicate, Ctrl+D works for you.
To copy properties from a material to existing others, you can try Component Clipboard.
To copy by script, this API might be right.
Your answer
Follow this Question
Related Questions
Copying gameObject doesn't work as intended 1 Answer
How to fill polygon collider with a texture? 0 Answers
Unity Login Server Address 0 Answers
How to make a Tovel like cube (edge smooth?) 2 Answers
Can you Help ME? 1 Answer