📜  material Array setter - C# 代码示例

📅  最后修改于: 2022-03-11 14:49:05.595000             🧑  作者: Mango

代码示例1
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MaterialArraySetter : MonoBehaviour {

    public Material Material1;

    void Start ()
    {
        Material[] materialsArray = GetComponent().materials;
        materialsArray[1] = Material1;
        GetComponent().materials = materialsArray;

    }

}