blob: ba98c5f7f835ca1088d3efca566df6f96e9a6359 (
plain)
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
42
43
44
45
|
using System.IO;
using UnityEditor;
using UnityEngine;
namespace VRCSDK.SDK3.Editor
{
[InitializeOnLoad]
public class SDK3AImportFix
{
private const string packageRuntimePluginsFolder = "Packages/com.vrchat.avatars/Runtime/VRCSDK/Plugins";
private const string legacyRuntimePluginsFolder = "Assets/VRCSDK/Plugins/";
private const string SDK3_IMPORTS_FIXED = "SDK3AImportsFixed";
static SDK3AImportFix()
{
// Only run once per project
string key = Path.Combine(Application.dataPath, SDK3_IMPORTS_FIXED);
if (EditorPrefs.HasKey(key))
return;
EditorPrefs.SetBool(key, true);
Run();
}
public static void Run(){
if (Directory.Exists(packageRuntimePluginsFolder))
{
AssetDatabase.ImportAsset($"{packageRuntimePluginsFolder}/VRCSDK3A.dll",
ImportAssetOptions.ForceSynchronousImport);
AssetDatabase.ImportAsset($"{packageRuntimePluginsFolder}/VRCSDK3A-Editor.dll",
ImportAssetOptions.ForceSynchronousImport);
AssetDatabase.ImportPackage($"Packages/com.vrchat.avatars/Samples~/AV3 Demo Assets/SDK3A.unitypackage",
false);
}
else if (Directory.Exists(legacyRuntimePluginsFolder))
{
AssetDatabase.ImportAsset($"{legacyRuntimePluginsFolder}/VRCSDK3A.dll",
ImportAssetOptions.ForceSynchronousImport);
AssetDatabase.ImportAsset($"{legacyRuntimePluginsFolder}/VRCSDK3A-Editor.dll",
ImportAssetOptions.ForceSynchronousImport);
}
}
}
}
|