The CreateCopy
method creates a duplicate of the current Material
instance. This can be useful when you need to modify a material without affecting the original instance.
The CreateCopy
method creates a duplicate of the current Material
instance. This can be useful when you need to modify a material without affecting the original instance.
To use the CreateCopy
method, call it on an existing Material
object. The method returns a new Material
object that is a copy of the original.
// Assume 'originalMaterial' is an existing Material instance Material copiedMaterial = originalMaterial.CreateCopy(); // Now 'copiedMaterial' is a separate instance and can be modified independently copiedMaterial.Set("Color", new Color(1.0f, 0.0f, 0.0f)); // Set the color to red