Documentation

Unity Engine


Unity Engine


CopyMatchingPropertiesFromMaterial(Material)

Copies properties, keyword states and settings from mat to this material, but only if they exist in both materials.
Read time 1 minuteLast updated a month ago

Definition

  • Type: Method
  • Namespace: UnityEngine
  • Assembly: UnityEngine.CoreModule
public void CopyMatchingPropertiesFromMaterial(Material mat)

Parameters

The Material to copy from.

Remarks

This method copies the following properties if they exist in both materials:

Examples

using UnityEngine;public class Example : MonoBehaviour{ // Attach this script to a GameObject that has a renderer. // Copies any property from mat and assigns it to this transform's material, if the property exists in both materials. Material mat; void Start() { GetComponent<Renderer>().material.CopyMatchingPropertiesFromMaterial(mat); }}