using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
#if UNITY_EDITOR
using UnityEditor;
#endif
public class N : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
#if UNITY_EDITOR
//编辑器文件操作
//load
Material mat = AssetDatabase.LoadAssetAtPath("Assets/Materials/m1.mat",
typeof(Material)) as Material;//将路径对应文件取出来转化成对应文件储存
//modify
mat.color = Color.blue;//修改该文件的一些参数
EditorUtility.SetDirty(mat);//告诉编译器该文件被修改
AssetDatabase.SaveAssets();//将该文件重新保存
#endif
}
// Update is called once per frame
void Update()
{
}
}
Unity学习笔记/*编辑器文件操作AssetDateBase接口**/
最新推荐文章于 2024-05-16 20:28:16 发布