浏览代码

bring boatattack up to work again

/incrementalpipeline2
Lucas Meijer 5 年前
当前提交
7137442f
共有 3 个文件被更改,包括 26 次插入23 次删除
  1. 26
      Assets/IncrementalPipelineSupport/AddressablesBuildPipelineCustomizer.cs
  2. 23
      Assets/IncrementalPipelineSupport/AddressableFilesProvider.cs
  3. 0
      /Assets/IncrementalPipelineSupport/AddressablesBuildPipelineCustomizer.cs.meta

26
Assets/IncrementalPipelineSupport/AddressablesBuildPipelineCustomizer.cs


using System;
using System.IO;
using System.Linq;
using Unity.Build.Classic;
using UnityEngine.AddressableAssets;
public class AddressablesBuildPipelineCustomizer : ClassicBuildPipelineCustomizer
{
public override void RegisterAdditionalFilesToDeploy(Action<string, string> registerAdditionalFileToDeploy)
{
if (!Directory.Exists(Addressables.BuildPath))
return;
var buildPath = Addressables.BuildPath;
var relativeRoot = Path.GetDirectoryName(Path.GetDirectoryName(buildPath));
var fileToCopies = Directory.GetFiles(buildPath, "*.*", SearchOption.AllDirectories).ToArray();
foreach (var fileToCopy in fileToCopies)
{
var relative = fileToCopy.Substring(relativeRoot.Length+1);
var targetFile = $"{StreamingAssetsDirectory}/{relative}";
registerAdditionalFileToDeploy(fileToCopy, targetFile);
}
}
}

23
Assets/IncrementalPipelineSupport/AddressableFilesProvider.cs


using System.IO;
using System.Linq;
using Unity.Build.Classic;
using UnityEngine.AddressableAssets;
public class AddressableFilesProvider : AdditionalFilesProviderBase
{
protected override void OnPrepareAdditionalAssetsBeforeBuild()
{
if (!Directory.Exists(Addressables.BuildPath))
return;
var buildPath = Addressables.BuildPath;
var relativeRoot = Path.GetDirectoryName(Path.GetDirectoryName(buildPath));
var fileToCopies = Directory.GetFiles(buildPath, "*.*", SearchOption.AllDirectories).ToArray();
foreach (var fileToCopy in fileToCopies)
{
var relative = fileToCopy.Substring(relativeRoot.Length+1);
var targetFile = $"{StreamingAssetsDirectory}/{relative}";
AddFile(fileToCopy, targetFile);
}
}
}

/Assets/IncrementalPipelineSupport/AddressableFilesProvider.cs.meta → /Assets/IncrementalPipelineSupport/AddressablesBuildPipelineCustomizer.cs.meta

正在加载...
取消
保存