BuildHelpers.cs
1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Xml;
using System.Xml.Linq;
using UnityEditor;
using UnityEditor.Build;
using UnityEditor.Build.Reporting;
using UnityEngine;
namespace UnityEditor.XR.Management
{
internal static class BuildHelpers
{
internal static void CleanOldSettings<T>()
{
UnityEngine.Object[] preloadedAssets = PlayerSettings.GetPreloadedAssets();
if (preloadedAssets == null)
return;
var oldSettings = from s in preloadedAssets
where s != null && s.GetType() == typeof(T)
select s;
if (oldSettings != null && oldSettings.Any())
{
var assets = preloadedAssets.ToList();
foreach (var s in oldSettings)
{
assets.Remove(s);
}
PlayerSettings.SetPreloadedAssets(assets.ToArray());
}
}
}
}