Add VRChat and GitHub packages to Unity project
This commit is contained in:
1 parent
0334a52b21
commit
85538aaccc
3297 files changed
+847877
No files matched your search
@@ -0,0 +1,120 @@
|
||||
using System.Reflection;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
|
||||
public class VRCSdk3Analysis
|
||||
{
|
||||
static Assembly GetAssemblyByName(string name)
|
||||
{
|
||||
return AppDomain.CurrentDomain.GetAssemblies().
|
||||
SingleOrDefault(assembly => assembly.GetName().Name == name);
|
||||
}
|
||||
|
||||
static List<Component> GetSceneComponentsFromAssembly( Assembly assembly )
|
||||
{
|
||||
if (assembly == null)
|
||||
return new List<Component>();
|
||||
|
||||
Type[] types = assembly.GetTypes();
|
||||
|
||||
List<Component> present = new List<Component>();
|
||||
foreach (var type in types )
|
||||
{
|
||||
if (!type.IsSubclassOf(typeof(MonoBehaviour)))
|
||||
continue;
|
||||
|
||||
var monos = VRC.Tools.FindSceneObjectsOfTypeAll(type);
|
||||
present.AddRange(monos);
|
||||
}
|
||||
return present;
|
||||
}
|
||||
|
||||
public enum SdkVersion
|
||||
{
|
||||
VRCSDK2,
|
||||
VRCSDK3
|
||||
};
|
||||
|
||||
public static List<Component> GetSDKInScene(SdkVersion version)
|
||||
{
|
||||
var assembly = GetAssemblyByName( version.ToString() );
|
||||
return GetSceneComponentsFromAssembly(assembly);
|
||||
}
|
||||
|
||||
public static bool IsSdkDllActive(SdkVersion version)
|
||||
{
|
||||
string assembly = version.ToString();
|
||||
PluginImporter importer = AssetImporter.GetAtPath("Assets/VRCSDK/Plugins/" + assembly + ".dll") as PluginImporter;
|
||||
if (importer == false)
|
||||
{
|
||||
//Handle Avatar Dll Split
|
||||
importer = AssetImporter.GetAtPath("Assets/VRCSDK/Plugins/" + assembly + "A.dll") as PluginImporter;
|
||||
if (importer == false)
|
||||
return false;
|
||||
}
|
||||
|
||||
return importer.GetCompatibleWithAnyPlatform();
|
||||
}
|
||||
|
||||
//public static void SetSdkVersionActive(SdkVersion version)
|
||||
//{
|
||||
// AssetDatabase.StartAssetEditing();
|
||||
|
||||
// PluginImporter importer = AssetImporter.GetAtPath("Assets/VRCSDK/Plugins/" + version + ".dll") as PluginImporter;
|
||||
// if (importer == null)
|
||||
// return;
|
||||
|
||||
// SetSDKDefine(version);
|
||||
|
||||
// var other = SdkVersion.VRCSDK2;
|
||||
// if (version == SdkVersion.VRCSDK2)
|
||||
// other = SdkVersion.VRCSDK3;
|
||||
|
||||
// SetSDKAssembly(other, false);
|
||||
// SetSDKAssembly(version, true);
|
||||
|
||||
// AssetDatabase.StopAssetEditing();
|
||||
//}
|
||||
|
||||
//static void SetSDKAssembly( SdkVersion version, bool active )
|
||||
//{
|
||||
// string assembly = version.ToString();
|
||||
// PluginImporter importer = AssetImporter.GetAtPath("Assets/VRCSDK/Plugins/" + assembly + ".dll") as PluginImporter;
|
||||
// if (importer)
|
||||
// {
|
||||
// importer.SetCompatibleWithAnyPlatform(active);
|
||||
// importer.SetCompatibleWithEditor(active);
|
||||
// importer.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows, active);
|
||||
// importer.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows64, active);
|
||||
// importer.SetCompatibleWithPlatform(BuildTarget.StandaloneLinux64, active);
|
||||
// importer.SetCompatibleWithPlatform(BuildTarget.StandaloneOSX, active);
|
||||
// importer.SetCompatibleWithPlatform(BuildTarget.Android, active);
|
||||
// importer.SaveAndReimport();
|
||||
// }
|
||||
//}
|
||||
|
||||
//static void SetSDKDefine( SdkVersion version )
|
||||
//{
|
||||
// string defineString = PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone);
|
||||
// var defs = defineString.Split(';');
|
||||
// string finalDefs = null;
|
||||
// foreach( var s in defs )
|
||||
// {
|
||||
// if (s != "VRC_SDK_VRCSDK2" && s != "VRC_SDK_VRCSDK3")
|
||||
// {
|
||||
// if (finalDefs == null)
|
||||
// finalDefs = s;
|
||||
// else
|
||||
// finalDefs += ";" + s;
|
||||
// }
|
||||
// }
|
||||
// if (version == SdkVersion.VRCSDK2)
|
||||
// finalDefs += ";VRC_SDK_VRCSDK2";
|
||||
// else if (version == SdkVersion.VRCSDK3)
|
||||
// finalDefs += ";VRC_SDK_VRCSDK3";
|
||||
// PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone, finalDefs);
|
||||
//}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 93710d221addc0243ba90dd20369844b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in new issue
Block a user