From e4c59f0a9bc07b756fc8d4e67c9505c675fef940 Mon Sep 17 00:00:00 2001 From: jellejurre Date: Sun, 8 Oct 2023 00:19:20 +0200 Subject: [PATCH 01/12] Add Instancer + Example package --- .../ExamplePackage.asmdef | 15 ++ .../ExamplePackage.asmdef.meta | 7 + dev.vrlabs.examplepackage/ExamplePackage.cs | 54 +++++ .../ExamplePackage.cs.meta | 3 + dev.vrlabs.examplepackage/package.json | 7 + dev.vrlabs.examplepackage/package.json.meta | 7 + dev.vrlabs.instancer/Instancer.asmdef | 15 ++ dev.vrlabs.instancer/Instancer.asmdef.meta | 7 + dev.vrlabs.instancer/Instancer.cs | 187 ++++++++++++++++++ dev.vrlabs.instancer/Instancer.cs.meta | 11 ++ dev.vrlabs.instancer/package.json | 9 + dev.vrlabs.instancer/package.json.meta | 7 + 12 files changed, 329 insertions(+) create mode 100644 dev.vrlabs.examplepackage/ExamplePackage.asmdef create mode 100644 dev.vrlabs.examplepackage/ExamplePackage.asmdef.meta create mode 100644 dev.vrlabs.examplepackage/ExamplePackage.cs create mode 100644 dev.vrlabs.examplepackage/ExamplePackage.cs.meta create mode 100644 dev.vrlabs.examplepackage/package.json create mode 100644 dev.vrlabs.examplepackage/package.json.meta create mode 100644 dev.vrlabs.instancer/Instancer.asmdef create mode 100644 dev.vrlabs.instancer/Instancer.asmdef.meta create mode 100644 dev.vrlabs.instancer/Instancer.cs create mode 100644 dev.vrlabs.instancer/Instancer.cs.meta create mode 100644 dev.vrlabs.instancer/package.json create mode 100644 dev.vrlabs.instancer/package.json.meta diff --git a/dev.vrlabs.examplepackage/ExamplePackage.asmdef b/dev.vrlabs.examplepackage/ExamplePackage.asmdef new file mode 100644 index 0000000..204ee1c --- /dev/null +++ b/dev.vrlabs.examplepackage/ExamplePackage.asmdef @@ -0,0 +1,15 @@ +{ + "name": "NewAssembly", + "references": [], + "includePlatforms": [ + "Editor" + ], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/dev.vrlabs.examplepackage/ExamplePackage.asmdef.meta b/dev.vrlabs.examplepackage/ExamplePackage.asmdef.meta new file mode 100644 index 0000000..ab6cad6 --- /dev/null +++ b/dev.vrlabs.examplepackage/ExamplePackage.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 0e310fa7b919ec24c801c0464933c96a +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/dev.vrlabs.examplepackage/ExamplePackage.cs b/dev.vrlabs.examplepackage/ExamplePackage.cs new file mode 100644 index 0000000..1be3091 --- /dev/null +++ b/dev.vrlabs.examplepackage/ExamplePackage.cs @@ -0,0 +1,54 @@ +using System; +using System.Linq; +using System.Reflection; +using UnityEditor; +using UnityEngine; + +namespace VRLabs +{ + public class MyFancyPackage : ScriptableObject + { + public const string packageName = "ExamplePackage"; + + public static BindingFlags ALL = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | + BindingFlags.NonPublic; + + public static string[] excludeRegexs = + { + ".*\\.cs", + ".*\\.asmdef", + "package.json" + }; + + [MenuItem("VRLabs/FunkyThing")] + public static void FancyPackage() + { + Type instancerType = AppDomain.CurrentDomain.GetAssemblies() + .Where(x => x.GetType("VRLabs.Instancer") != null) + .Select(x => x.GetType("VRLabs.Instancer")).FirstOrDefault(); + + if (instancerType == null) + { + Debug.LogError("Instancer not found. This Shouldn't Compile. Please tell the VRLabs devs"); + return; + } + + MethodInfo instanceMethod = instancerType.GetMethod("Instance", ALL); + + if (instanceMethod == null) + { + Debug.LogError("Instance method not found"); + return; + } + + // Gives disk path, Unity uses Packages/dev.vrlabs.fancy, can't use this + // string assetPath = new System.Diagnostics.StackTrace(true).GetFrame(0).GetFileName(); + + var editor = ScriptableObject.CreateInstance(); + var script = MonoScript.FromScriptableObject(editor); + var assetPath = AssetDatabase.GetAssetPath(script); + + instanceMethod.Invoke(null, new object[] { packageName, assetPath, excludeRegexs }); + } + } +} \ No newline at end of file diff --git a/dev.vrlabs.examplepackage/ExamplePackage.cs.meta b/dev.vrlabs.examplepackage/ExamplePackage.cs.meta new file mode 100644 index 0000000..48284f6 --- /dev/null +++ b/dev.vrlabs.examplepackage/ExamplePackage.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 112f8c28ff964bcfa82a9cba06c24661 +timeCreated: 1696452033 \ No newline at end of file diff --git a/dev.vrlabs.examplepackage/package.json b/dev.vrlabs.examplepackage/package.json new file mode 100644 index 0000000..ba35998 --- /dev/null +++ b/dev.vrlabs.examplepackage/package.json @@ -0,0 +1,7 @@ +{ + "name": "dev.vrlabs.example", + "displayName": "VRLabs - ExamplePackage", + "version": "0.0.2", + "unity": "2019.4", + "description": "This is Very Fancy" +} \ No newline at end of file diff --git a/dev.vrlabs.examplepackage/package.json.meta b/dev.vrlabs.examplepackage/package.json.meta new file mode 100644 index 0000000..455c8ff --- /dev/null +++ b/dev.vrlabs.examplepackage/package.json.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 6be2fee1f3e37e944ba42874163b14ef +PackageManifestImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/dev.vrlabs.instancer/Instancer.asmdef b/dev.vrlabs.instancer/Instancer.asmdef new file mode 100644 index 0000000..0a734b2 --- /dev/null +++ b/dev.vrlabs.instancer/Instancer.asmdef @@ -0,0 +1,15 @@ +{ + "name": "Ins", + "references": [], + "includePlatforms": [ + "Editor" + ], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/dev.vrlabs.instancer/Instancer.asmdef.meta b/dev.vrlabs.instancer/Instancer.asmdef.meta new file mode 100644 index 0000000..baadc07 --- /dev/null +++ b/dev.vrlabs.instancer/Instancer.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 44ac4a1843f825840be7bb2141159917 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/dev.vrlabs.instancer/Instancer.cs b/dev.vrlabs.instancer/Instancer.cs new file mode 100644 index 0000000..3c71fb7 --- /dev/null +++ b/dev.vrlabs.instancer/Instancer.cs @@ -0,0 +1,187 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text.RegularExpressions; +using JetBrains.Annotations; +using UnityEditor; +using UnityEngine; +using Object = UnityEngine.Object; + +namespace VRLabs +{ + public class Instancer : MonoBehaviour + { + public static string Instance(string packageName, string installFilePath, string[] excludeRegexs) + { + if (!installFilePath.Replace("\\", "/").StartsWith("Packages/")) + { + Debug.LogError($"Package not found in Packages folder, please move the {packageName} package to the Packages folder."); + return null; + } + + string targetFolder = EditorUtility.OpenFolderPanel("Select Directory To Copy Assets To", "Assets/", ""); + + if (targetFolder == "" || targetFolder == null) + { + Debug.LogError("No folder selected, please select a folder to copy the assets to."); + return null; + } + + if (!targetFolder.Contains(Application.dataPath)) + { + Debug.LogError("Selected folder is not in the Assets folder, please select a folder in the Assets directory."); + return null; + } + + targetFolder = PrepareTargetFolderPath(targetFolder, packageName); + + string sourceFolder = GetSourceFolder(installFilePath); + + string[] localAssetPaths = GetLocalAssetPaths(sourceFolder, excludeRegexs); + + CreateDirectories(localAssetPaths, targetFolder); + + CopyFiles(localAssetPaths, sourceFolder, targetFolder); + + FixReferences(localAssetPaths, sourceFolder, targetFolder); + + return targetFolder; + } + + public static void Install(string packageName, string installFilePath, string[] filePaths, Action callBack) + { + string instancePath = Instance(packageName, installFilePath, filePaths); + callBack(instancePath); + } + + static string PrepareTargetFolderPath(string folderPath, string packageName) + { + folderPath = "Assets" + folderPath.Remove(0, Application.dataPath.Length) + "/" + packageName; + + if (Directory.Exists(folderPath)) + { + int i = 1; + while (Directory.Exists(folderPath + i.ToString())) + { + i++; + } + + folderPath += i; + } + + Directory.CreateDirectory(folderPath); + AssetDatabase.ImportAsset(folderPath); + return folderPath; + } + + static string GetSourceFolder(string installFilePath) + { + string sourceFolder = installFilePath; + + while (Path.GetDirectoryName(sourceFolder) != "Packages") + { + sourceFolder = Path.GetDirectoryName(sourceFolder); + } + + return sourceFolder.Replace("\\", "/"); + } + + static string[] GetLocalAssetPaths(string sourceFolder, string[] excludeRegexs) + { + string[] assetPaths = AssetDatabase.FindAssets("", new [] { sourceFolder }).Select(AssetDatabase.GUIDToAssetPath).ToArray(); + + string[] filteredLocalAssetPaths = assetPaths + .Select(path => path.Remove(0,sourceFolder.Length)) + .Where(path => excludeRegexs.All(regex => !Regex.Match(path, regex).Success)) + .ToArray(); + + return filteredLocalAssetPaths; + } + + static void CreateDirectories(string[] filePaths, string targetFolder) + { + try + { + AssetDatabase.StartAssetEditing(); + foreach (string path in filePaths) + { + string targetPath = Path.GetDirectoryName(targetFolder + path); + if (!Directory.Exists(targetPath)) + { + Directory.CreateDirectory(targetPath); + AssetDatabase.ImportAsset(targetPath); + } + } + } + finally + { + AssetDatabase.StopAssetEditing(); + } + } + + static void CopyFiles(string[] filePaths, string sourceFolder, string targetFolder) + { + try + { + AssetDatabase.StartAssetEditing(); + foreach (string path in filePaths) + { + AssetDatabase.CopyAsset(sourceFolder + path, targetFolder + path); + } + } + finally{ + AssetDatabase.StopAssetEditing(); + } + } + + static void FixReferences(string[] localAssetPaths, string sourceFolder, string targetFolder) + { + foreach (string localAssetPath in localAssetPaths) + { + string targetAssetPath = targetFolder + localAssetPath; + UnityEngine.Object[] targetAssets = AssetDatabase.LoadAllAssetsAtPath(targetAssetPath); + foreach (var targetAsset in targetAssets) + { + SerializedObject serializedObject = new SerializedObject(targetAsset); + SerializedProperty property = serializedObject.GetIterator(); + do + { + if (property.propertyType == SerializedPropertyType.ObjectReference) + { + // Debug.Log($"O{property.name}, {property.displayName}, {property.objectReferenceValue}"); + if (property.objectReferenceValue != null) + { + property.objectReferenceValue = GetTargetVersion(sourceFolder, targetFolder, property.objectReferenceValue); + } + } + + if (property.propertyType == SerializedPropertyType.ExposedReference) + { + // Debug.Log($"E{property.name}, {property.displayName}, {property.exposedReferenceValue}"); + if (property.exposedReferenceValue != null) + { + property.exposedReferenceValue = GetTargetVersion(sourceFolder, targetFolder, property.exposedReferenceValue); + } + } + } while (property.Next(true)); + + serializedObject.ApplyModifiedProperties(); + } + } + } + + private static Object GetTargetVersion(string sourceFolder, string targetFolder, Object target) + { + string targetPath = AssetDatabase.GetAssetPath(target); + if (targetPath.StartsWith(sourceFolder)) + { + string newTargetPath = targetFolder + targetPath.Remove(0, sourceFolder.Length); + return AssetDatabase.LoadAssetAtPath(newTargetPath, target.GetType()); + } + + return target; + } + } +} diff --git a/dev.vrlabs.instancer/Instancer.cs.meta b/dev.vrlabs.instancer/Instancer.cs.meta new file mode 100644 index 0000000..67e4257 --- /dev/null +++ b/dev.vrlabs.instancer/Instancer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 33640aae14a3e724c844c667dc30e888 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/dev.vrlabs.instancer/package.json b/dev.vrlabs.instancer/package.json new file mode 100644 index 0000000..23fdf41 --- /dev/null +++ b/dev.vrlabs.instancer/package.json @@ -0,0 +1,9 @@ +{ + "name": "dev.vrlabs.instancer", + "displayName": "VRLabs - Instancer", + "version": "0.0.2", + "unity": "2019.4", + "description": "This is Very Fancy", + "dependencies": { + } +} \ No newline at end of file diff --git a/dev.vrlabs.instancer/package.json.meta b/dev.vrlabs.instancer/package.json.meta new file mode 100644 index 0000000..c02f165 --- /dev/null +++ b/dev.vrlabs.instancer/package.json.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 4c09229de853fb34e9a3865e461e5855 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: From 7c090aa280de02df9124dbfb0bc2521a7790de33 Mon Sep 17 00:00:00 2001 From: jellejurre Date: Sun, 8 Oct 2023 11:08:41 +0200 Subject: [PATCH 02/12] Fix ExamplePackage naming --- dev.vrlabs.examplepackage/ExamplePackage.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev.vrlabs.examplepackage/ExamplePackage.cs b/dev.vrlabs.examplepackage/ExamplePackage.cs index 1be3091..589d607 100644 --- a/dev.vrlabs.examplepackage/ExamplePackage.cs +++ b/dev.vrlabs.examplepackage/ExamplePackage.cs @@ -6,7 +6,7 @@ namespace VRLabs { - public class MyFancyPackage : ScriptableObject + public class ExamplePackage : ScriptableObject { public const string packageName = "ExamplePackage"; @@ -44,7 +44,7 @@ public static void FancyPackage() // Gives disk path, Unity uses Packages/dev.vrlabs.fancy, can't use this // string assetPath = new System.Diagnostics.StackTrace(true).GetFrame(0).GetFileName(); - var editor = ScriptableObject.CreateInstance(); + var editor = ScriptableObject.CreateInstance(); var script = MonoScript.FromScriptableObject(editor); var assetPath = AssetDatabase.GetAssetPath(script); From 70db2eeedf5ef298549a6afb58916f05cc825e47 Mon Sep 17 00:00:00 2001 From: jellejurre Date: Sun, 8 Oct 2023 11:08:58 +0200 Subject: [PATCH 03/12] Support sub assets --- dev.vrlabs.instancer/Instancer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev.vrlabs.instancer/Instancer.cs b/dev.vrlabs.instancer/Instancer.cs index 3c71fb7..73b9f97 100644 --- a/dev.vrlabs.instancer/Instancer.cs +++ b/dev.vrlabs.instancer/Instancer.cs @@ -178,7 +178,7 @@ private static Object GetTargetVersion(string sourceFolder, string targetFolder, if (targetPath.StartsWith(sourceFolder)) { string newTargetPath = targetFolder + targetPath.Remove(0, sourceFolder.Length); - return AssetDatabase.LoadAssetAtPath(newTargetPath, target.GetType()); + return AssetDatabase.LoadAllAssetsAtPath(newTargetPath).Where(obj => obj.GetType() == target.GetType()).FirstOrDefault(x => x.name == target.name); } return target; From 37edaaa6657da5fd953b45a8a4ccf6772510e244 Mon Sep 17 00:00:00 2001 From: jellejurre Date: Fri, 15 Dec 2023 16:37:23 +0100 Subject: [PATCH 04/12] Add namespaces, update error message --- dev.vrlabs.examplepackage/ExamplePackage.cs | 14 ++++---------- dev.vrlabs.instancer/Instancer.cs | 2 +- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/dev.vrlabs.examplepackage/ExamplePackage.cs b/dev.vrlabs.examplepackage/ExamplePackage.cs index 589d607..3b75ed0 100644 --- a/dev.vrlabs.examplepackage/ExamplePackage.cs +++ b/dev.vrlabs.examplepackage/ExamplePackage.cs @@ -4,15 +4,12 @@ using UnityEditor; using UnityEngine; -namespace VRLabs +namespace VRLabs.ExamplePackage { public class ExamplePackage : ScriptableObject { public const string packageName = "ExamplePackage"; - public static BindingFlags ALL = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | - BindingFlags.NonPublic; - public static string[] excludeRegexs = { ".*\\.cs", @@ -20,7 +17,7 @@ public class ExamplePackage : ScriptableObject "package.json" }; - [MenuItem("VRLabs/FunkyThing")] + [MenuItem("VRLabs/ExamplePackage")] public static void FancyPackage() { Type instancerType = AppDomain.CurrentDomain.GetAssemblies() @@ -29,20 +26,17 @@ public static void FancyPackage() if (instancerType == null) { - Debug.LogError("Instancer not found. This Shouldn't Compile. Please tell the VRLabs devs"); + Debug.LogError("Instancer not found. To use this functionality, install the VRLabs Instancer from https://github.com/VRLabs/Instancer"); return; } - MethodInfo instanceMethod = instancerType.GetMethod("Instance", ALL); + MethodInfo instanceMethod = instancerType.GetMethod("Instance", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (instanceMethod == null) { Debug.LogError("Instance method not found"); return; } - - // Gives disk path, Unity uses Packages/dev.vrlabs.fancy, can't use this - // string assetPath = new System.Diagnostics.StackTrace(true).GetFrame(0).GetFileName(); var editor = ScriptableObject.CreateInstance(); var script = MonoScript.FromScriptableObject(editor); diff --git a/dev.vrlabs.instancer/Instancer.cs b/dev.vrlabs.instancer/Instancer.cs index 73b9f97..0ddc93f 100644 --- a/dev.vrlabs.instancer/Instancer.cs +++ b/dev.vrlabs.instancer/Instancer.cs @@ -9,7 +9,7 @@ using UnityEngine; using Object = UnityEngine.Object; -namespace VRLabs +namespace VRLabs.Instancer { public class Instancer : MonoBehaviour { From 4cc08ef9f9f9e9e3b468c47f535c725e2d03c283 Mon Sep 17 00:00:00 2001 From: jellejurre Date: Fri, 15 Dec 2023 18:20:20 +0100 Subject: [PATCH 05/12] Update namespace to look for --- dev.vrlabs.examplepackage/ExamplePackage.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev.vrlabs.examplepackage/ExamplePackage.cs b/dev.vrlabs.examplepackage/ExamplePackage.cs index 3b75ed0..172e01a 100644 --- a/dev.vrlabs.examplepackage/ExamplePackage.cs +++ b/dev.vrlabs.examplepackage/ExamplePackage.cs @@ -21,8 +21,8 @@ public class ExamplePackage : ScriptableObject public static void FancyPackage() { Type instancerType = AppDomain.CurrentDomain.GetAssemblies() - .Where(x => x.GetType("VRLabs.Instancer") != null) - .Select(x => x.GetType("VRLabs.Instancer")).FirstOrDefault(); + .Where(x => x.GetType("VRLabs.Instancer.Instancer") != null) + .Select(x => x.GetType("VRLabs.Instancer.Instancer")).FirstOrDefault(); if (instancerType == null) { From 40ac14cbbe3d71e9bfb34de0e9913a11f8d70c92 Mon Sep 17 00:00:00 2001 From: jellejurre Date: Fri, 15 Dec 2023 19:28:59 +0100 Subject: [PATCH 06/12] Move stuff to subfolder, fix subfolder copying --- dev.vrlabs.examplepackage/Instancer.meta | 8 ++++++++ .../{ => Instancer}/ExamplePackage.asmdef | 11 +++++++++-- .../Instancer/ExamplePackage.asmdef.meta | 7 +++++++ .../{ => Instancer}/ExamplePackage.cs | 6 ++++-- .../{ => Instancer}/ExamplePackage.cs.meta | 0 dev.vrlabs.instancer/Instancer.asmdef | 3 ++- dev.vrlabs.instancer/Instancer.cs | 13 +++++-------- 7 files changed, 35 insertions(+), 13 deletions(-) create mode 100644 dev.vrlabs.examplepackage/Instancer.meta rename dev.vrlabs.examplepackage/{ => Instancer}/ExamplePackage.asmdef (54%) create mode 100644 dev.vrlabs.examplepackage/Instancer/ExamplePackage.asmdef.meta rename dev.vrlabs.examplepackage/{ => Instancer}/ExamplePackage.cs (93%) rename dev.vrlabs.examplepackage/{ => Instancer}/ExamplePackage.cs.meta (100%) diff --git a/dev.vrlabs.examplepackage/Instancer.meta b/dev.vrlabs.examplepackage/Instancer.meta new file mode 100644 index 0000000..43ea213 --- /dev/null +++ b/dev.vrlabs.examplepackage/Instancer.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 42db504ee559df34a9e3e9ac3391aa4c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/dev.vrlabs.examplepackage/ExamplePackage.asmdef b/dev.vrlabs.examplepackage/Instancer/ExamplePackage.asmdef similarity index 54% rename from dev.vrlabs.examplepackage/ExamplePackage.asmdef rename to dev.vrlabs.examplepackage/Instancer/ExamplePackage.asmdef index 204ee1c..fe9ffa1 100644 --- a/dev.vrlabs.examplepackage/ExamplePackage.asmdef +++ b/dev.vrlabs.examplepackage/Instancer/ExamplePackage.asmdef @@ -1,5 +1,6 @@ { - "name": "NewAssembly", + "name": "VRLabs Examplepackage Instancer", + "rootNamespace": "", "references": [], "includePlatforms": [ "Editor" @@ -10,6 +11,12 @@ "precompiledReferences": [], "autoReferenced": true, "defineConstraints": [], - "versionDefines": [], + "versionDefines": [ + { + "name": "dev.vrlabs.instancer", + "expression": "", + "define": "VRLABS_INSTANCER_FOUND" + } + ], "noEngineReferences": false } \ No newline at end of file diff --git a/dev.vrlabs.examplepackage/Instancer/ExamplePackage.asmdef.meta b/dev.vrlabs.examplepackage/Instancer/ExamplePackage.asmdef.meta new file mode 100644 index 0000000..07b54b2 --- /dev/null +++ b/dev.vrlabs.examplepackage/Instancer/ExamplePackage.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 4f02e1ca6410441479672d440e6997e5 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/dev.vrlabs.examplepackage/ExamplePackage.cs b/dev.vrlabs.examplepackage/Instancer/ExamplePackage.cs similarity index 93% rename from dev.vrlabs.examplepackage/ExamplePackage.cs rename to dev.vrlabs.examplepackage/Instancer/ExamplePackage.cs index 172e01a..c053288 100644 --- a/dev.vrlabs.examplepackage/ExamplePackage.cs +++ b/dev.vrlabs.examplepackage/Instancer/ExamplePackage.cs @@ -1,4 +1,5 @@ -using System; +#if VRLABS_INSTANCER_FOUND +using System; using System.Linq; using System.Reflection; using UnityEditor; @@ -45,4 +46,5 @@ public static void FancyPackage() instanceMethod.Invoke(null, new object[] { packageName, assetPath, excludeRegexs }); } } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/dev.vrlabs.examplepackage/ExamplePackage.cs.meta b/dev.vrlabs.examplepackage/Instancer/ExamplePackage.cs.meta similarity index 100% rename from dev.vrlabs.examplepackage/ExamplePackage.cs.meta rename to dev.vrlabs.examplepackage/Instancer/ExamplePackage.cs.meta diff --git a/dev.vrlabs.instancer/Instancer.asmdef b/dev.vrlabs.instancer/Instancer.asmdef index 0a734b2..f01d29f 100644 --- a/dev.vrlabs.instancer/Instancer.asmdef +++ b/dev.vrlabs.instancer/Instancer.asmdef @@ -1,5 +1,6 @@ { - "name": "Ins", + "name": "VRLabs Instancer", + "rootNamespace": "", "references": [], "includePlatforms": [ "Editor" diff --git a/dev.vrlabs.instancer/Instancer.cs b/dev.vrlabs.instancer/Instancer.cs index 0ddc93f..6e981cc 100644 --- a/dev.vrlabs.instancer/Instancer.cs +++ b/dev.vrlabs.instancer/Instancer.cs @@ -15,12 +15,6 @@ public class Instancer : MonoBehaviour { public static string Instance(string packageName, string installFilePath, string[] excludeRegexs) { - if (!installFilePath.Replace("\\", "/").StartsWith("Packages/")) - { - Debug.LogError($"Package not found in Packages folder, please move the {packageName} package to the Packages folder."); - return null; - } - string targetFolder = EditorUtility.OpenFolderPanel("Select Directory To Copy Assets To", "Assets/", ""); if (targetFolder == "" || targetFolder == null) @@ -80,7 +74,7 @@ static string GetSourceFolder(string installFilePath) { string sourceFolder = installFilePath; - while (Path.GetDirectoryName(sourceFolder) != "Packages") + while (!File.Exists(sourceFolder + "/package.json")) { sourceFolder = Path.GetDirectoryName(sourceFolder); } @@ -128,7 +122,10 @@ static void CopyFiles(string[] filePaths, string sourceFolder, string targetFold AssetDatabase.StartAssetEditing(); foreach (string path in filePaths) { - AssetDatabase.CopyAsset(sourceFolder + path, targetFolder + path); + if (!Directory.Exists(sourceFolder + path)) + { + AssetDatabase.CopyAsset(sourceFolder + path, targetFolder + path); + } } } finally{ From 16c8ef93ae7907c2f2ec6e9dcf2f68015cc4de02 Mon Sep 17 00:00:00 2001 From: jellejurre Date: Fri, 15 Dec 2023 19:43:41 +0100 Subject: [PATCH 07/12] Add AssetDatabase Refresh --- dev.vrlabs.instancer/Instancer.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dev.vrlabs.instancer/Instancer.cs b/dev.vrlabs.instancer/Instancer.cs index 6e981cc..5f3657f 100644 --- a/dev.vrlabs.instancer/Instancer.cs +++ b/dev.vrlabs.instancer/Instancer.cs @@ -41,6 +41,8 @@ public static string Instance(string packageName, string installFilePath, string FixReferences(localAssetPaths, sourceFolder, targetFolder); + AssetDatabase.Refresh(); + return targetFolder; } From 1b9a83fc678a44fe38fbc42f765cd6baf813c72a Mon Sep 17 00:00:00 2001 From: jellejurre Date: Thu, 22 Feb 2024 00:41:31 +0100 Subject: [PATCH 08/12] Ready package for release --- .github/update-version-json.js | 15 ++++ .../VRC-Asset-Release-And-Upload.yml | 84 +++++++++++++++++++ .../Instancer.asmdef => Instancer.asmdef | 0 ...ancer.asmdef.meta => Instancer.asmdef.meta | 0 .../Instancer.cs => Instancer.cs | 0 .../Instancer.cs.meta => Instancer.cs.meta | 0 LICENSE | 2 +- .../Instancer.meta => LICENSE.meta | 3 +- Readme.md | 54 ++++++++++++ .../package.json.meta => Readme.md.meta | 4 +- .../ExamplePackage.asmdef.meta | 7 -- .../Instancer/ExamplePackage.asmdef | 22 ----- .../Instancer/ExamplePackage.asmdef.meta | 7 -- .../Instancer/ExamplePackage.cs | 50 ----------- .../Instancer/ExamplePackage.cs.meta | 3 - dev.vrlabs.examplepackage/package.json | 7 -- dev.vrlabs.instancer/package.json | 9 -- package.json | 22 +++++ .../package.json.meta => package.json.meta | 0 19 files changed, 179 insertions(+), 110 deletions(-) create mode 100644 .github/update-version-json.js create mode 100644 .github/workflows/VRC-Asset-Release-And-Upload.yml rename dev.vrlabs.instancer/Instancer.asmdef => Instancer.asmdef (100%) rename dev.vrlabs.instancer/Instancer.asmdef.meta => Instancer.asmdef.meta (100%) rename dev.vrlabs.instancer/Instancer.cs => Instancer.cs (100%) rename dev.vrlabs.instancer/Instancer.cs.meta => Instancer.cs.meta (100%) rename dev.vrlabs.examplepackage/Instancer.meta => LICENSE.meta (67%) create mode 100644 Readme.md rename dev.vrlabs.examplepackage/package.json.meta => Readme.md.meta (60%) delete mode 100644 dev.vrlabs.examplepackage/ExamplePackage.asmdef.meta delete mode 100644 dev.vrlabs.examplepackage/Instancer/ExamplePackage.asmdef delete mode 100644 dev.vrlabs.examplepackage/Instancer/ExamplePackage.asmdef.meta delete mode 100644 dev.vrlabs.examplepackage/Instancer/ExamplePackage.cs delete mode 100644 dev.vrlabs.examplepackage/Instancer/ExamplePackage.cs.meta delete mode 100644 dev.vrlabs.examplepackage/package.json delete mode 100644 dev.vrlabs.instancer/package.json create mode 100644 package.json rename dev.vrlabs.instancer/package.json.meta => package.json.meta (100%) diff --git a/.github/update-version-json.js b/.github/update-version-json.js new file mode 100644 index 0000000..335df25 --- /dev/null +++ b/.github/update-version-json.js @@ -0,0 +1,15 @@ +const fs = require('fs'); + +if (!process.argv[2]) { + console.log("::error file=prepare-package.js::a version number is needed"); + return +} + +let versionNumber = process.argv[2]; + +var jsonFile = JSON.parse(fs.readFileSync('package.json')); + +jsonFile.version = versionNumber; +jsonFile.url = "https://github.com/VRLabs/Contact-Tracker/releases/download/"+versionNumber +"/Contact_Tracker_"+versionNumber+".zip" + +fs.writeFileSync('package.json', JSON.stringify(jsonFile, null, 2)); \ No newline at end of file diff --git a/.github/workflows/VRC-Asset-Release-And-Upload.yml b/.github/workflows/VRC-Asset-Release-And-Upload.yml new file mode 100644 index 0000000..ac34bff --- /dev/null +++ b/.github/workflows/VRC-Asset-Release-And-Upload.yml @@ -0,0 +1,84 @@ +name: VRC Asset Release and Listing Upload +on: + push: + tags: + - "*.*.*" + +env: + ASSETS_PATH: . + RELEASE_PATH: Packages + ARTIFACT_DURATION: 30 # In days + UPLOAD_ENDPOINT: https://api.vrlabs.dev/packages/add + WORKFLOW_VERSION: 1.0.0 + +jobs: + build: + runs-on: "ubuntu-latest" + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Check if package.json exists + run: | + if [ ! -f package.json ]; then + echo "package.json not found" + exit 1 + fi + + - name: Get package.json + id: get_package_json + run: | + { + echo 'package_json<<"""' + echo $(cat package.json) + echo '"""' + } >> $GITHUB_OUTPUT + + - name: Get needed Data + id: job_data + run: | + version=$(echo "${{ github.ref_name }}") + version=$(echo $version | tr '[:upper:]' '[:lower:]') + echo "version=$version" >> $GITHUB_OUTPUT + major_version=$(echo $version | cut -d '.' -f 1) + minor_version=$(echo $version | cut -d '.' -f 2) + echo "major_version=$major_version" >> $GITHUB_OUTPUT + echo "minor_version=$minor_version" >> $GITHUB_OUTPUT + name="${{ fromJson(steps.get_package_json.outputs.package_json).name }}" + display_name="${{ fromJson(steps.get_package_json.outputs.package_json).displayName }}" + echo "package_name=$name" >> $GITHUB_OUTPUT + echo "package_display_name=$display_name" >> $GITHUB_OUTPUT + + - name: Create Packages + id: create_packages + uses: VRLabs/VRCTools-Packaging-Action@v1 + with: + path: '${{ env.ASSETS_PATH }}' + outputPath: '${{ env.RELEASE_PATH }}' + releaseUrl: 'https://github.com/${{ github.repository }}/releases/download/${{ steps.job_data.outputs.version }}/${{ steps.job_data.outputs.package_name }}-${{ steps.job_data.outputs.version }}.zip' + unityReleaseUrl: 'https://github.com/${{ github.repository }}/releases/download/${{ steps.job_data.outputs.version }}/${{ steps.job_data.outputs.package_name }}-${{ steps.job_data.outputs.version }}.unitypackage' + releaseVersion: '${{ steps.job_data.outputs.version }}' + + - name: Create Release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + name: "${{ steps.job_data.outputs.package_display_name }} ${{ steps.job_data.outputs.version }}" + files: | + ${{ steps.create_packages.outputs.unityPackagePath }} + ${{ steps.create_packages.outputs.vccPackagePath }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SOURCE_TAG: ${{ steps.job_data.outputs.version }} + + - name: Add server-json to Artifacts + uses: actions/upload-artifact@v3 + with: + name: server-json + path: ${{ steps.create_packages.outputs.serverPackageJsonPath }} + retention-days: ${{ env.ARTIFACT_DURATION }} + + - name: Send package info to a server + run: | + curl -X POST -H "Content-Type: application/json" -H "Vrl-Api-Key: ${{ secrets.LISTINGS_API_KEY }}" --data @${{ steps.create_packages.outputs.serverPackageJsonPath }} ${{ env.UPLOAD_ENDPOINT }} || exit 0 + shell: bash \ No newline at end of file diff --git a/dev.vrlabs.instancer/Instancer.asmdef b/Instancer.asmdef similarity index 100% rename from dev.vrlabs.instancer/Instancer.asmdef rename to Instancer.asmdef diff --git a/dev.vrlabs.instancer/Instancer.asmdef.meta b/Instancer.asmdef.meta similarity index 100% rename from dev.vrlabs.instancer/Instancer.asmdef.meta rename to Instancer.asmdef.meta diff --git a/dev.vrlabs.instancer/Instancer.cs b/Instancer.cs similarity index 100% rename from dev.vrlabs.instancer/Instancer.cs rename to Instancer.cs diff --git a/dev.vrlabs.instancer/Instancer.cs.meta b/Instancer.cs.meta similarity index 100% rename from dev.vrlabs.instancer/Instancer.cs.meta rename to Instancer.cs.meta diff --git a/LICENSE b/LICENSE index fd9766f..6a98738 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023 VRLabs +Copyright (c) 2022 VRLabs LLC Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/dev.vrlabs.examplepackage/Instancer.meta b/LICENSE.meta similarity index 67% rename from dev.vrlabs.examplepackage/Instancer.meta rename to LICENSE.meta index 43ea213..9bd91f5 100644 --- a/dev.vrlabs.examplepackage/Instancer.meta +++ b/LICENSE.meta @@ -1,6 +1,5 @@ fileFormatVersion: 2 -guid: 42db504ee559df34a9e3e9ac3391aa4c -folderAsset: yes +guid: 461cd0fd8411849428bf7df6426826b3 DefaultImporter: externalObjects: {} userData: diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..cb2db46 --- /dev/null +++ b/Readme.md @@ -0,0 +1,54 @@ +
+ +# Instancer + +[![Generic badge](https://img.shields.io/github/downloads/VRLabs/Instancer/total?label=Downloads)](https://github.com/VRLabs/Instancer/releases/latest) +[![Generic badge](https://img.shields.io/badge/License-MIT-informational.svg)](https://github.com/VRLabs/Instancer/blob/main/LICENSE) +[![Generic badge](https://img.shields.io/badge/Unity-2019.4.31f1-lightblue.svg)](https://unity3d.com/unity/whats-new/2019.4.31) +[![Generic badge](https://img.shields.io/badge/SDK-AvatarSDK3-lightblue.svg)](https://vrchat.com/home/download) + +[![Generic badge](https://img.shields.io/discord/706913824607043605?color=%237289da&label=DISCORD&logo=Discord&style=for-the-badge)](https://discord.vrlabs.dev/) +[![Generic badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fshieldsio-patreon.vercel.app%2Fapi%3Fusername%3Dvrlabs%26type%3Dpatrons&style=for-the-badge)](https://patreon.vrlabs.dev/) + +VRLabs' Instancing system that copies files over for use in the Assets directory and can also runs install scripts + +### ⬇️ [Download Latest Version](https://github.com/VRLabs/Instancer/releases/latest) + + +--- + +## How it works + +* It gets called by a small dummy file included in the package, and when called copies all the files over, and replaces references to old files with references to new files. +* It can also run an install script callback once it's done with this. + +## Install guide + +* It should generally only be installed as a dependency of a VRLabs package + +## How to use + +* Click the `VRLabs/[PackageName]` button in the toolbar and select an output folder to copy to. + +## Contributors + +* [Jelle](https://jellejurre.dev) +* +## License + +Instancer is available as-is under MIT. For more information see [LICENSE](https://github.com/VRLabs/Instancer/blob/main/LICENSE). + +​ + +
+ +[](https://vrlabs.dev "VRLabs") + +[](https://discord.vrlabs.dev/ "VRLabs") + +[](https://patreon.vrlabs.dev/ "VRLabs") + +[](https://twitter.com/vrlabsdev "VRLabs") + +
+ diff --git a/dev.vrlabs.examplepackage/package.json.meta b/Readme.md.meta similarity index 60% rename from dev.vrlabs.examplepackage/package.json.meta rename to Readme.md.meta index 455c8ff..62a24d6 100644 --- a/dev.vrlabs.examplepackage/package.json.meta +++ b/Readme.md.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: 6be2fee1f3e37e944ba42874163b14ef -PackageManifestImporter: +guid: 59a694973c9b4f84c845c329c7c06f91 +TextScriptImporter: externalObjects: {} userData: assetBundleName: diff --git a/dev.vrlabs.examplepackage/ExamplePackage.asmdef.meta b/dev.vrlabs.examplepackage/ExamplePackage.asmdef.meta deleted file mode 100644 index ab6cad6..0000000 --- a/dev.vrlabs.examplepackage/ExamplePackage.asmdef.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 0e310fa7b919ec24c801c0464933c96a -AssemblyDefinitionImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/dev.vrlabs.examplepackage/Instancer/ExamplePackage.asmdef b/dev.vrlabs.examplepackage/Instancer/ExamplePackage.asmdef deleted file mode 100644 index fe9ffa1..0000000 --- a/dev.vrlabs.examplepackage/Instancer/ExamplePackage.asmdef +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "VRLabs Examplepackage Instancer", - "rootNamespace": "", - "references": [], - "includePlatforms": [ - "Editor" - ], - "excludePlatforms": [], - "allowUnsafeCode": false, - "overrideReferences": false, - "precompiledReferences": [], - "autoReferenced": true, - "defineConstraints": [], - "versionDefines": [ - { - "name": "dev.vrlabs.instancer", - "expression": "", - "define": "VRLABS_INSTANCER_FOUND" - } - ], - "noEngineReferences": false -} \ No newline at end of file diff --git a/dev.vrlabs.examplepackage/Instancer/ExamplePackage.asmdef.meta b/dev.vrlabs.examplepackage/Instancer/ExamplePackage.asmdef.meta deleted file mode 100644 index 07b54b2..0000000 --- a/dev.vrlabs.examplepackage/Instancer/ExamplePackage.asmdef.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 4f02e1ca6410441479672d440e6997e5 -AssemblyDefinitionImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/dev.vrlabs.examplepackage/Instancer/ExamplePackage.cs b/dev.vrlabs.examplepackage/Instancer/ExamplePackage.cs deleted file mode 100644 index c053288..0000000 --- a/dev.vrlabs.examplepackage/Instancer/ExamplePackage.cs +++ /dev/null @@ -1,50 +0,0 @@ -#if VRLABS_INSTANCER_FOUND -using System; -using System.Linq; -using System.Reflection; -using UnityEditor; -using UnityEngine; - -namespace VRLabs.ExamplePackage -{ - public class ExamplePackage : ScriptableObject - { - public const string packageName = "ExamplePackage"; - - public static string[] excludeRegexs = - { - ".*\\.cs", - ".*\\.asmdef", - "package.json" - }; - - [MenuItem("VRLabs/ExamplePackage")] - public static void FancyPackage() - { - Type instancerType = AppDomain.CurrentDomain.GetAssemblies() - .Where(x => x.GetType("VRLabs.Instancer.Instancer") != null) - .Select(x => x.GetType("VRLabs.Instancer.Instancer")).FirstOrDefault(); - - if (instancerType == null) - { - Debug.LogError("Instancer not found. To use this functionality, install the VRLabs Instancer from https://github.com/VRLabs/Instancer"); - return; - } - - MethodInfo instanceMethod = instancerType.GetMethod("Instance", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); - - if (instanceMethod == null) - { - Debug.LogError("Instance method not found"); - return; - } - - var editor = ScriptableObject.CreateInstance(); - var script = MonoScript.FromScriptableObject(editor); - var assetPath = AssetDatabase.GetAssetPath(script); - - instanceMethod.Invoke(null, new object[] { packageName, assetPath, excludeRegexs }); - } - } -} -#endif \ No newline at end of file diff --git a/dev.vrlabs.examplepackage/Instancer/ExamplePackage.cs.meta b/dev.vrlabs.examplepackage/Instancer/ExamplePackage.cs.meta deleted file mode 100644 index 48284f6..0000000 --- a/dev.vrlabs.examplepackage/Instancer/ExamplePackage.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 112f8c28ff964bcfa82a9cba06c24661 -timeCreated: 1696452033 \ No newline at end of file diff --git a/dev.vrlabs.examplepackage/package.json b/dev.vrlabs.examplepackage/package.json deleted file mode 100644 index ba35998..0000000 --- a/dev.vrlabs.examplepackage/package.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "dev.vrlabs.example", - "displayName": "VRLabs - ExamplePackage", - "version": "0.0.2", - "unity": "2019.4", - "description": "This is Very Fancy" -} \ No newline at end of file diff --git a/dev.vrlabs.instancer/package.json b/dev.vrlabs.instancer/package.json deleted file mode 100644 index 23fdf41..0000000 --- a/dev.vrlabs.instancer/package.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "name": "dev.vrlabs.instancer", - "displayName": "VRLabs - Instancer", - "version": "0.0.2", - "unity": "2019.4", - "description": "This is Very Fancy", - "dependencies": { - } -} \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..f9d228f --- /dev/null +++ b/package.json @@ -0,0 +1,22 @@ +{ + "name": "dev.vrlabs.instancer", + "displayName": "VRLabs Instancer", + "version": "1.0.999", + "license": "MIT", + "unity": "2019.4", + "description": "VRLabs' Instancing system that copies files over for use in the Assets directory and can also runs install scripts.", + "author": { + "name": "VRLabs", + "email": "mail@vrlabs.dev", + "url": "https://vrlabs.dev" + }, + "siteUrl": "https://github.com/VRLabs/Instancer", + "vpmDependencies": {}, + "legacyFolders": {}, + "unityPackageDestinationFolder": "Assets/VRLabs/Instancer", + "vccRepoCategory": "essentials", + "unityPackageDestinationFolderMetas": { + "Assets/VRLabs": "652a1ba5b00554143bc9a76307dbc4e8", + "Assets/VRLabs/Instancer": "28d5f0bca06a0d147aae2cbccaaf54a3" + } +} \ No newline at end of file diff --git a/dev.vrlabs.instancer/package.json.meta b/package.json.meta similarity index 100% rename from dev.vrlabs.instancer/package.json.meta rename to package.json.meta From 06098567acb1ff53e186065a44d6f6564188a0a4 Mon Sep 17 00:00:00 2001 From: jellejurre Date: Thu, 22 Feb 2024 16:12:27 +0100 Subject: [PATCH 09/12] Move instancer to dependencies category --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f9d228f..e6f4f0b 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "vpmDependencies": {}, "legacyFolders": {}, "unityPackageDestinationFolder": "Assets/VRLabs/Instancer", - "vccRepoCategory": "essentials", + "vccRepoCategory": "dependencies", "unityPackageDestinationFolderMetas": { "Assets/VRLabs": "652a1ba5b00554143bc9a76307dbc4e8", "Assets/VRLabs/Instancer": "28d5f0bca06a0d147aae2cbccaaf54a3" From dd424218112b421e968c86f2b13f2b5fd087a5ff Mon Sep 17 00:00:00 2001 From: jellejurre Date: Sun, 25 Feb 2024 22:31:01 +0100 Subject: [PATCH 10/12] Remove unneeded page --- .github/update-version-json.js | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 .github/update-version-json.js diff --git a/.github/update-version-json.js b/.github/update-version-json.js deleted file mode 100644 index 335df25..0000000 --- a/.github/update-version-json.js +++ /dev/null @@ -1,15 +0,0 @@ -const fs = require('fs'); - -if (!process.argv[2]) { - console.log("::error file=prepare-package.js::a version number is needed"); - return -} - -let versionNumber = process.argv[2]; - -var jsonFile = JSON.parse(fs.readFileSync('package.json')); - -jsonFile.version = versionNumber; -jsonFile.url = "https://github.com/VRLabs/Contact-Tracker/releases/download/"+versionNumber +"/Contact_Tracker_"+versionNumber+".zip" - -fs.writeFileSync('package.json', JSON.stringify(jsonFile, null, 2)); \ No newline at end of file From d2491cbfd20e11901f0e3fb5edf10ffa3924786d Mon Sep 17 00:00:00 2001 From: jellejurre Date: Sun, 25 Feb 2024 22:32:54 +0100 Subject: [PATCH 11/12] Remove unneeded import --- Instancer.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Instancer.cs b/Instancer.cs index 5f3657f..f1ef4ab 100644 --- a/Instancer.cs +++ b/Instancer.cs @@ -1,10 +1,9 @@ -using System; +using System; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text.RegularExpressions; -using JetBrains.Annotations; using UnityEditor; using UnityEngine; using Object = UnityEngine.Object; From d7d2a0035dae0cee152345f76e9ecb372845d4bb Mon Sep 17 00:00:00 2001 From: jellejurre Date: Mon, 26 Feb 2024 21:19:31 +0100 Subject: [PATCH 12/12] Rename regexes --- Instancer.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Instancer.cs b/Instancer.cs index f1ef4ab..6366953 100644 --- a/Instancer.cs +++ b/Instancer.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections; using System.Collections.Generic; using System.IO; @@ -45,9 +45,9 @@ public static string Instance(string packageName, string installFilePath, string return targetFolder; } - public static void Install(string packageName, string installFilePath, string[] filePaths, Action callBack) + public static void Install(string packageName, string installFilePath, string[] excludeRegexs, Action callBack) { - string instancePath = Instance(packageName, installFilePath, filePaths); + string instancePath = Instance(packageName, installFilePath, excludeRegexs); callBack(instancePath); }