Version: 2023.1

AssetPostprocessor.OnPostprocessMaterial(Material)

切换到手册

描述

Add this function to a subclass to get a notification when a new Material is created during an import of a ModelImporter.

使用此方法修改导入期间新创建的材质资源的属性。

Note: This method is only called by the ModelImporter when the ModelImporter.MaterialImportMode option is set to ModelImporterMaterialImportMode.ImportStandard.

using UnityEngine;
using UnityEditor;

public class MakeMaterialsRed : AssetPostprocessor { void OnPostprocessMaterial(Material material) { material.color = Color.red; } }