Version: 2022.3
언어: 한국어

Material.CopyMatchingPropertiesFromMaterial

매뉴얼로 전환
public void CopyMatchingPropertiesFromMaterial (Material mat);

파라미터

mat The Material to copy from.

설명

Copies properties, keyword states and settings from mat to this material, but only if they exist in both materials.

This method copies the following properties if they exist in both materials: Serialized material properties. Non-serialized runtime properties in the shaders. Keyword states, if the keywords exist in both shaders. Material settings: Material.doubleSidedGI, Material.enableInstancing, Material.renderQueue and Material.globalIlluminationFlags.

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); } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961