changing Texture on a material of a child object effecting all child game object of that prefab

Hi, i am using Unity 4.1.5 and i am currently working on a game. I have created some child objects of a prefab and when i try to change texture on one child object through script(or in editor) it effects to all child object of that prefab. how do i make change only to thatparticular object.


this is what i have used in script. where color[carColorChanging.colorPointer] is a texture.
Note:script is attached to only one child object

sharedMaterial is exactly that - it’s the material shared by all gameobjects that use this specific material.

If you want to change only the specific object, use:

transform.renderer.material.mainTexture = color[carColorChanging.colorPointer];

this will create a duplicate of the material and assign it only to this object, leaving all the other objects that use this material unchanged.