mat | 要从中复制的 Material。 |
将 mat
中的属性、关键字状态和设置复制到此材质,但仅当它们存在于两种材质中时。
此方法会复制以下属性(如果它们存在于两种材质中):
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); } }