From 82dac98f38766ff0d9fb98607e68544e6e65a3fa Mon Sep 17 00:00:00 2001 From: Harrison Hough Date: Thu, 12 Oct 2023 08:02:49 +0300 Subject: [PATCH 1/9] chore: ignore samples meta --- .gitignore | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 144ec3af..a27e6a7a 100644 --- a/.gitignore +++ b/.gitignore @@ -58,5 +58,8 @@ sysinfo.txt # Crashlytics generated file crashlytics-build.properties - .idea/ + +# Samples meta files +**/Samples~.meta +**/Samples.meta From bfc83d5a30fd96eda62f25bdc0df0955de540d9e Mon Sep 17 00:00:00 2001 From: Harrison Hough Date: Thu, 12 Oct 2023 15:07:55 +0300 Subject: [PATCH 2/9] [SDK-544] feat: update context menu ordering to add separators (#129) - update menu item priority for better separation - also moved the Unity-SDK only menu items (internal dev functions) into a separate RPM Tools section. This enables us to cleanup Ready Player Me section and also see exactly what developers would see after importing the package into a project --- Editor/Module Management/ModuleUpdater.cs | 4 +--- .../UI/EditorWindows/AvatarLoaderEditor/AvatarLoaderEditor.cs | 2 +- Editor/UI/EditorWindows/IntegrationGuide/IntegrationGuide.cs | 2 +- Editor/UI/EditorWindows/SetupGuide/SetupGuide.cs | 2 +- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Editor/Module Management/ModuleUpdater.cs b/Editor/Module Management/ModuleUpdater.cs index 6b9f1c88..e809c4ae 100644 --- a/Editor/Module Management/ModuleUpdater.cs +++ b/Editor/Module Management/ModuleUpdater.cs @@ -43,7 +43,6 @@ private class Release private const string AVATAR_LOADER_PACKAGE = "com.readyplayerme.avatarloader"; - static ModuleUpdater() { EntryPoint.Startup += () => Check(true); @@ -52,7 +51,7 @@ static ModuleUpdater() /// /// Check for Ready Player Me package updates. /// - [MenuItem("Ready Player Me/Check For Updates")] + [MenuItem("Ready Player Me/Check For Updates", priority = 23)] public static void CheckForUpdates() { AnalyticsEditorLogger.EventLogger.LogCheckForUpdates(); @@ -81,7 +80,6 @@ private static void Check(bool isStartup = false) .Split(new[] { ".git" }, StringSplitOptions.None)[0] .Replace(GITHUB_WEBSITE, GITHUB_API_URL) + "/releases"; - var packageUrl = repoUrl.Split('#')[0]; // Experimental or prerelease packages might look like 0.1.0-exp.1, remove after dash to parse with Version diff --git a/Editor/UI/EditorWindows/AvatarLoaderEditor/AvatarLoaderEditor.cs b/Editor/UI/EditorWindows/AvatarLoaderEditor/AvatarLoaderEditor.cs index 335e17ea..864cb291 100644 --- a/Editor/UI/EditorWindows/AvatarLoaderEditor/AvatarLoaderEditor.cs +++ b/Editor/UI/EditorWindows/AvatarLoaderEditor/AvatarLoaderEditor.cs @@ -25,7 +25,7 @@ public class AvatarLoaderEditor : EditorWindow private bool useEyeAnimations; private bool useVoiceToAnim; - [MenuItem("Ready Player Me/Avatar Loader", priority = 0)] + [MenuItem("Ready Player Me/Avatar Loader", priority = 1)] public static void ShowWindow() { #if !GLTFAST diff --git a/Editor/UI/EditorWindows/IntegrationGuide/IntegrationGuide.cs b/Editor/UI/EditorWindows/IntegrationGuide/IntegrationGuide.cs index d5996b04..3cf2f442 100644 --- a/Editor/UI/EditorWindows/IntegrationGuide/IntegrationGuide.cs +++ b/Editor/UI/EditorWindows/IntegrationGuide/IntegrationGuide.cs @@ -21,7 +21,7 @@ public class IntegrationGuide : EditorWindow [SerializeField] private VisualTreeAsset visualTreeAsset; - [MenuItem("Ready Player Me/Integration Guide")] + [MenuItem("Ready Player Me/Integration Guide", priority = 12)] public static void ShowWindow() { var window = GetWindow(); diff --git a/Editor/UI/EditorWindows/SetupGuide/SetupGuide.cs b/Editor/UI/EditorWindows/SetupGuide/SetupGuide.cs index 88992496..8c7570ef 100644 --- a/Editor/UI/EditorWindows/SetupGuide/SetupGuide.cs +++ b/Editor/UI/EditorWindows/SetupGuide/SetupGuide.cs @@ -35,7 +35,7 @@ public class SetupGuide : EditorWindow private Button finishSetupButton; private Button openQuickStartButton; - [MenuItem("Ready Player Me/Setup Guide")] + [MenuItem("Ready Player Me/Setup Guide", priority = 12)] public static void ShowWindow() { var window = GetWindow(); From 3fc5d86f034fe89df450768a539f27f30e62318d Mon Sep 17 00:00:00 2001 From: Robin <1121080+rYuuk@users.noreply.github.com> Date: Tue, 17 Oct 2023 10:48:06 +0200 Subject: [PATCH 3/9] [SDK-514] Disable use demo toggle in setup guide (#131) ## [SDK-514](https://ready-player-me.atlassian.net/browse/SDK-514) ## Description - Disable use demo toggle in setup guide --- .github/CODEOWNERS | 3 +-- Editor/UI/EditorWindows/SetupGuide/SetupGuide.uxml | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index bb58ce5d..bfb6b5bf 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -2,5 +2,4 @@ # the repo. Unless a later match takes precedence, # @HarrisonHough, @rYuuk will be requested for # review when someone opens a pull request. -* @HarrisonHough @rYuuk - +* @readyplayerme/onboarding-integrations diff --git a/Editor/UI/EditorWindows/SetupGuide/SetupGuide.uxml b/Editor/UI/EditorWindows/SetupGuide/SetupGuide.uxml index e81a3295..ba5fec29 100644 --- a/Editor/UI/EditorWindows/SetupGuide/SetupGuide.uxml +++ b/Editor/UI/EditorWindows/SetupGuide/SetupGuide.uxml @@ -13,7 +13,7 @@ - + From f43e3eeac00f891eb30d71dda33c69efe4acecb1 Mon Sep 17 00:00:00 2001 From: Harrison Hough Date: Wed, 18 Oct 2023 06:41:36 +0300 Subject: [PATCH 4/9] [SDK-558] feat: refactored symbol edit logic and added symbol remove logic (#133) - remove define symbols when core is removed via package manager - refactor define symbol edit logic into separate class --- Editor/Module Management/ModuleInstaller.cs | 56 +++++---------- .../AvatarLoaderEditor/AvatarLoaderEditor.cs | 2 +- Editor/Utils/DefineSymbolHelper.cs | 72 +++++++++++++++++++ Editor/Utils/DefineSymbolHelper.cs.meta | 11 +++ 4 files changed, 102 insertions(+), 39 deletions(-) create mode 100644 Editor/Utils/DefineSymbolHelper.cs create mode 100644 Editor/Utils/DefineSymbolHelper.cs.meta diff --git a/Editor/Module Management/ModuleInstaller.cs b/Editor/Module Management/ModuleInstaller.cs index 5b2d5e28..f894ea0b 100644 --- a/Editor/Module Management/ModuleInstaller.cs +++ b/Editor/Module Management/ModuleInstaller.cs @@ -22,8 +22,6 @@ public static class ModuleInstaller private const int THREAD_SLEEP_TIME = 100; private const string PROGRESS_BAR_TITLE = "Ready Player Me"; - private const string GLTFAST_SYMBOL = "GLTFAST"; - private const string READY_PLAYER_ME_SYMBOL = "READY_PLAYER_ME"; private const string GLTFAST_NAME = "com.atteneder.gltfast"; private const string WEBVIEW_NAME = "webview"; @@ -39,6 +37,8 @@ public static class ModuleInstaller static ModuleInstaller() { + Events.registeringPackages -= OnRegisteringPackages; + Events.registeringPackages += OnRegisteringPackages; # if RPM_DEVELOPMENT modulesInstalled = true; #endif @@ -47,16 +47,29 @@ static ModuleInstaller() InstallModules(); EditorApplication.delayCall += DelayCreateCoreSettings; } - + #if !GLTFAST if (IsModuleInstalled(GLTFAST_NAME)) { - AddGltfastSymbol(); - AddScriptingDefineSymbolToAllBuildTargetGroups(READY_PLAYER_ME_SYMBOL); + DefineSymbolHelper.AddSymbols(); } #endif } + + /// + /// Called when a package is about to be added, removed or changed. + /// + /// Describes the PackageInfo entries of packages currently registering. + private static void OnRegisteringPackages(PackageRegistrationEventArgs args) + { + // Core module uninstalled + if (args.removed != null && args.removed.Any(p => p.name == ModuleList.Core.name)) + { + DefineSymbolHelper.RemoveSymbols(); + ProjectPrefs.SetBool(ProjectPrefs.FIRST_TIME_SETUP_DONE, false); + } + } private static void DelayCreateCoreSettings() { @@ -158,39 +171,6 @@ public static PackageInfo[] GetPackageList() return listRequest.Result.ToArray(); } - public static void AddGltfastSymbol() - { - AddScriptingDefineSymbolToAllBuildTargetGroups(GLTFAST_SYMBOL); - } - - private static void AddScriptingDefineSymbolToAllBuildTargetGroups(string defineSymbol) - { - foreach (BuildTarget target in Enum.GetValues(typeof(BuildTarget))) - { - BuildTargetGroup group = BuildPipeline.GetBuildTargetGroup(target); - - if (group == BuildTargetGroup.Unknown) - { - continue; - } - - List defineSymbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(group).Split(';').Select(d => d.Trim()).ToList(); - - if (defineSymbols.Contains(defineSymbol)) continue; - defineSymbols.Add(defineSymbol); - try - { - PlayerSettings.SetScriptingDefineSymbolsForGroup(group, string.Join(";", defineSymbols.ToArray())); - } - catch (Exception e) - { - Debug.LogWarning("Could not set RPM " + defineSymbol + " defines for build target: " + target + " group: " + group + " " + e); - } - } - - CompilationPipeline.RequestScriptCompilation(); - } - /// /// Check all modules installed successfully /// diff --git a/Editor/UI/EditorWindows/AvatarLoaderEditor/AvatarLoaderEditor.cs b/Editor/UI/EditorWindows/AvatarLoaderEditor/AvatarLoaderEditor.cs index 864cb291..25a2d483 100644 --- a/Editor/UI/EditorWindows/AvatarLoaderEditor/AvatarLoaderEditor.cs +++ b/Editor/UI/EditorWindows/AvatarLoaderEditor/AvatarLoaderEditor.cs @@ -29,7 +29,7 @@ public class AvatarLoaderEditor : EditorWindow public static void ShowWindow() { #if !GLTFAST - ModuleInstaller.AddGltfastSymbol(); + DefineSymbolHelper.AddSymbols(); #endif var window = GetWindow(); window.titleContent = new GUIContent(AVATAR_LOADER); diff --git a/Editor/Utils/DefineSymbolHelper.cs b/Editor/Utils/DefineSymbolHelper.cs new file mode 100644 index 00000000..9a0bcdd5 --- /dev/null +++ b/Editor/Utils/DefineSymbolHelper.cs @@ -0,0 +1,72 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using UnityEditor; +using UnityEditor.Compilation; + +namespace ReadyPlayerMe.Core.Editor +{ + public static class DefineSymbolHelper + { + private const string GLTFAST_SYMBOL = "GLTFAST"; + private const string READY_PLAYER_ME_SYMBOL = "READY_PLAYER_ME"; + + private static void ModifyScriptingDefineSymbolInAllBuildTargetGroups(string defineSymbol, bool addSymbol) + { + foreach (BuildTarget target in Enum.GetValues(typeof(BuildTarget))) + { + BuildTargetGroup group = BuildPipeline.GetBuildTargetGroup(target); + + if (group == BuildTargetGroup.Unknown) + { + continue; + } + + List defineSymbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(group).Split(';').Select(d => d.Trim()).ToList(); + + if (addSymbol && !defineSymbols.Contains(defineSymbol)) + { + defineSymbols.Add(defineSymbol); + } + else if (!addSymbol && defineSymbols.Contains(defineSymbol)) + { + defineSymbols.Remove(defineSymbol); + } + else + { + continue; + } + + try + { + PlayerSettings.SetScriptingDefineSymbolsForGroup(group, string.Join(";", defineSymbols.ToArray())); + } + catch (Exception e) + { + var actionWord = addSymbol ? "set" : "remove"; + Debug.LogWarning($"Could not {actionWord} {defineSymbol} defines for build target: {target} group: {group} {e}"); + } + } + + if (addSymbol) + { + CompilationPipeline.RequestScriptCompilation(); + } + } + + public static void AddSymbols() + { + ModifyScriptingDefineSymbolInAllBuildTargetGroups(GLTFAST_SYMBOL, true); + ModifyScriptingDefineSymbolInAllBuildTargetGroups(READY_PLAYER_ME_SYMBOL, true); + CompilationPipeline.RequestScriptCompilation(); + } + + public static void RemoveSymbols() + { + ModifyScriptingDefineSymbolInAllBuildTargetGroups(GLTFAST_SYMBOL, false); + ModifyScriptingDefineSymbolInAllBuildTargetGroups(READY_PLAYER_ME_SYMBOL, false); + } + + } +} diff --git a/Editor/Utils/DefineSymbolHelper.cs.meta b/Editor/Utils/DefineSymbolHelper.cs.meta new file mode 100644 index 00000000..27d0197c --- /dev/null +++ b/Editor/Utils/DefineSymbolHelper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f7f640bcb9cd21648a78581c77d76723 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: From 72198c49aad717ebb6a70ab43a81c269a03c2898 Mon Sep 17 00:00:00 2001 From: Harrison Hough Date: Thu, 19 Oct 2023 09:10:30 +0300 Subject: [PATCH 5/9] chore: update changelog link --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 34ee75c2..2ab57a52 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "unity": "2020.3", "unityRelease": "0f1", "documentationUrl": "https://docs.readyplayer.me/ready-player-me/integration-guides/unity-sdk", - "changelogUrl": "https://docs.readyplayer.me/ready-player-me/integration-guides/unity-sdk/changelog", + "changelogUrl": "https://github.com/readyplayerme/rpm-unity-sdk-core/blob/main/CHANGELOG.md", "licensesUrl": "https://github.com/readyplayerme/rpm-unity-sdk-core/blob/main/LICENSE.md", "dependencies": { "com.unity.nuget.newtonsoft-json": "3.0.2" From 6f906185e88dcea3679a251ab803a318da29ab73 Mon Sep 17 00:00:00 2001 From: Harrison Hough Date: Tue, 24 Oct 2023 06:26:45 +0300 Subject: [PATCH 6/9] chore: update unity version to fix netcode package API error --- .github/workflows/integration-test.yml | 2 +- .github/workflows/pr-test-runner.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index b3b7252b..8d70da74 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -17,7 +17,7 @@ jobs: testMode: - editmode unityVersion: - - 2020.3.0f1 + - 2020.3.16f1 steps: - name: Checkout empty unity project repository uses: actions/checkout@v3 diff --git a/.github/workflows/pr-test-runner.yml b/.github/workflows/pr-test-runner.yml index 97e12f81..b3d38c39 100644 --- a/.github/workflows/pr-test-runner.yml +++ b/.github/workflows/pr-test-runner.yml @@ -17,7 +17,7 @@ jobs: - playmode - editmode unityVersion: - - 2020.3.0f1 + - 2020.3.16f1 steps: - name: Checkout Unity-SDK Repository uses: actions/checkout@v3 From aceea41953a3c1ac27d54d26a1a861f8b5e8bd0d Mon Sep 17 00:00:00 2001 From: Robin <1121080+rYuuk@users.noreply.github.com> Date: Tue, 24 Oct 2023 12:52:49 +0200 Subject: [PATCH 7/9] [SDK-563] Add breaking change dialog (#136) ## [SDK-563](https://ready-player-me.atlassian.net/browse/SDK-563) ## Description - Added breaking change dialog when a major update is available --- Editor/Module Management/ModuleUpdater.cs | 21 ++- ...Visuals.meta => BreakingChangeDialog.meta} | 2 +- .../BreakingChangeDialog.cs | 47 +++++++ .../BreakingChangeDialog.cs.meta | 14 ++ .../BreakingChangeDialog.uxml | 16 +++ .../BreakingChangeDialog.uxml.meta | 10 ++ .../UI/Visuals/rpm_editor_window_banner.png | Bin 251805 -> 0 bytes .../Visuals/rpm_editor_window_banner.png.meta | 128 ------------------ 8 files changed, 107 insertions(+), 131 deletions(-) rename Editor/UI/{Visuals.meta => BreakingChangeDialog.meta} (77%) create mode 100644 Editor/UI/BreakingChangeDialog/BreakingChangeDialog.cs create mode 100644 Editor/UI/BreakingChangeDialog/BreakingChangeDialog.cs.meta create mode 100644 Editor/UI/BreakingChangeDialog/BreakingChangeDialog.uxml create mode 100644 Editor/UI/BreakingChangeDialog/BreakingChangeDialog.uxml.meta delete mode 100644 Editor/UI/Visuals/rpm_editor_window_banner.png delete mode 100644 Editor/UI/Visuals/rpm_editor_window_banner.png.meta diff --git a/Editor/Module Management/ModuleUpdater.cs b/Editor/Module Management/ModuleUpdater.cs index e809c4ae..c07dd967 100644 --- a/Editor/Module Management/ModuleUpdater.cs +++ b/Editor/Module Management/ModuleUpdater.cs @@ -147,8 +147,7 @@ private static void DisplayUpdateDialog(string packageName, Version currentVersi { // Update case 0: - packageUrl += "#v" + latestVersion; - UpdateModule(packageName, packageUrl, currentVersion, latestVersion); + CheckIfMajorRelease(packageName, currentVersion, latestVersion, packageUrl); break; // Cancel case 1: @@ -161,6 +160,23 @@ private static void DisplayUpdateDialog(string packageName, Version currentVersi } } + private static void CheckIfMajorRelease(string packageName, Version currentVersion, Version latestVersion, + string packageUrl) + { + if (latestVersion.Major > currentVersion.Major) + { + BreakingChangeDialog.ShowDialog(() => + { + UpdateModule(packageName, packageUrl, currentVersion, latestVersion); + }); + + } + else + { + UpdateModule(packageName, packageUrl, currentVersion, latestVersion); + } + } + /// /// Update the specified module by removing the current version and then adding the specified version. /// @@ -170,6 +186,7 @@ private static void DisplayUpdateDialog(string packageName, Version currentVersi /// The new version of the package. private static void UpdateModule(string name, string url, Version current, Version latest) { + url += "#v" + latest; CleanRedundantAvatarLoader(); RemoveRequest removeRequest = Client.Remove(name); while (!removeRequest.IsCompleted) Thread.Sleep(MILLISECONDS_TIMEOUT); diff --git a/Editor/UI/Visuals.meta b/Editor/UI/BreakingChangeDialog.meta similarity index 77% rename from Editor/UI/Visuals.meta rename to Editor/UI/BreakingChangeDialog.meta index a4b6abf4..089328a1 100644 --- a/Editor/UI/Visuals.meta +++ b/Editor/UI/BreakingChangeDialog.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 1b406a04e8ca820408032369d19f2b2e +guid: 6e97a78112f684e40ad730948b73896b folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Editor/UI/BreakingChangeDialog/BreakingChangeDialog.cs b/Editor/UI/BreakingChangeDialog/BreakingChangeDialog.cs new file mode 100644 index 00000000..a5273883 --- /dev/null +++ b/Editor/UI/BreakingChangeDialog/BreakingChangeDialog.cs @@ -0,0 +1,47 @@ +using System; +using UnityEditor; +using UnityEngine; +using UnityEngine.UIElements; + +namespace ReadyPlayerMe.Core.Editor +{ + public class BreakingChangeDialog : EditorWindow + { + private const string MIGRATION_GUIDE_URL = "https://docs.readyplayer.me/ready-player-me/integration-guides/unity/troubleshooting/updating-from-earlier-versions"; + private const string TITLE = "Update Packages"; + + [SerializeField] private VisualTreeAsset visualTreeAsset; + + private static Action updateClicked; + + public static void ShowDialog(Action onUpdate) + { + updateClicked = onUpdate; + + var window = GetWindow(); + window.titleContent = new GUIContent(TITLE); + window.minSize = new Vector2(500, 140); + window.maxSize = new Vector2(500, 140); + window.ShowModalUtility(); + } + + public void CreateGUI() + { + visualTreeAsset.CloneTree(rootVisualElement); + + var migrationLink = rootVisualElement.Q