Version: 2023.1
public static Cache AddCache (string cachePath);

参数

cachePath 缓存文件夹的路径。

描述

添加具有给定路径的缓存。

这允许您向缓存列表中添加新缓存。将返回对缓存的引用。

using System.IO;
using UnityEngine;

public class Example : MonoBehaviour { void AddCacheAtPath(string path) { if (!Directory.Exists(path)) Directory.CreateDirectory(path);

Cache newCache = Caching.AddCache(path);

//Make sure your new Cache is valid if (newCache.valid) { //If you wanted to set your newly created cache to the active cache Caching.currentCacheForWriting = newCache; } } }