From afd1d1ae6f1b7e686780cfe97fe6b1127e947324 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Raigo=20K=C3=B5vask?= Date: Tue, 5 Sep 2023 15:34:14 +0300 Subject: [PATCH 1/5] feat: add webgl example under the sdk samples --- Samples~/WebGLExample.meta | 8 + Samples~/WebGLExample/Editor.meta | 8 + .../WebGLExample/Editor/EditorWindows.meta | 8 + .../Editor/EditorWindows/ExampleSetup.cs | 21 + .../Editor/EditorWindows/ExampleSetup.cs.meta | 3 + .../Editor/EditorWindows/SetupTemplate.meta | 3 + .../SetupTemplate/SetupWebGLTemplate.cs | 108 ++ .../SetupTemplate/SetupWebGLTemplate.cs.meta | 14 + .../SetupTemplate/SetupWebGLTemplate.uxml | 15 + .../SetupWebGLTemplate.uxml.meta | 3 + ...dyPlayerMe.Core.WebGLExample.Editor.asmdef | 16 + ...yerMe.Core.WebGLExample.Editor.asmdef.meta | 7 + Samples~/WebGLExample/Prefabs.meta | 8 + .../WebGLExample/Prefabs/DebugPanel.prefab | 169 +++ .../Prefabs/DebugPanel.prefab.meta | 7 + Samples~/WebGLExample/Ready Player Me.meta | 8 + .../Ready Player Me/Resources.meta | 8 + .../Ready Player Me/Resources/Settings.meta | 8 + .../Settings/AvatarLoaderSettings.asset | 17 + .../Settings/AvatarLoaderSettings.asset.meta | 8 + .../Resources/Settings/CoreSettings.asset | 16 + .../Settings/CoreSettings.asset.meta | 8 + .../ReadyPlayerMe.Core.WebGLExample.asmdef | 17 + ...eadyPlayerMe.Core.WebGLExample.asmdef.meta | 7 + Samples~/WebGLExample/Scenes.meta | 8 + .../WebGLExample/Scenes/WebGLExample.unity | 1169 +++++++++++++++++ .../Scenes/WebGLExample.unity.meta | 7 + .../Scenes/WebGLExampleSettings.lighting | 63 + .../Scenes/WebGLExampleSettings.lighting.meta | 8 + Samples~/WebGLExample/Scripts.meta | 8 + Samples~/WebGLExample/Scripts/DebugLogger.cs | 12 + .../WebGLExample/Scripts/DebugLogger.cs.meta | 11 + Samples~/WebGLExample/Scripts/DemoCanvas.cs | 25 + .../WebGLExample/Scripts/DemoCanvas.cs.meta | 11 + .../WebGLExample/Scripts/WebFrameHandler.cs | 75 ++ .../Scripts/WebFrameHandler.cs.meta | 11 + .../WebGLExample/Scripts/WebGLAvatarLoader.cs | 63 + .../Scripts/WebGLAvatarLoader.cs.meta | 11 + Samples~/WebGLExample/Scripts/WebInterface.cs | 45 + .../WebGLExample/Scripts/WebInterface.cs.meta | 11 + Samples~/WebGLExample/WebGLTemplates.meta | 8 + .../WebGLTemplates/RPMTemplate.meta | 8 + .../RPMTemplate/TemplateData.meta | 8 + .../RPMTemplate/TemplateData/Global.js | 8 + .../RPMTemplate/TemplateData/Global.js.meta | 3 + .../TemplateData/ReadyPlayerMe.meta | 3 + .../ReadyPlayerMe/ReadyPlayerMeFrame.js | 73 + .../ReadyPlayerMe/ReadyPlayerMeFrame.js.meta | 3 + .../TemplateData/ReadyPlayerMe/RpmGlobal.js | 3 + .../ReadyPlayerMe/RpmGlobal.js.meta | 3 + .../TemplateData/ReadyPlayerMe/RpmStyle.css | 54 + .../ReadyPlayerMe/RpmStyle.css.meta | 3 + .../RPMTemplate/TemplateData/UnitySetup.js | 88 ++ .../TemplateData/UnitySetup.js.meta | 3 + .../RPMTemplate/TemplateData/favicon.ico | Bin 0 -> 13275 bytes .../RPMTemplate/TemplateData/favicon.ico.meta | 7 + .../TemplateData/fullscreen-button.png | Bin 0 -> 175 bytes .../TemplateData/fullscreen-button.png.meta | 7 + .../TemplateData/progress-bar-empty-dark.png | Bin 0 -> 96 bytes .../progress-bar-empty-dark.png.meta | 7 + .../TemplateData/progress-bar-empty-light.png | Bin 0 -> 109 bytes .../progress-bar-empty-light.png.meta | 7 + .../TemplateData/progress-bar-full-dark.png | Bin 0 -> 74 bytes .../progress-bar-full-dark.png.meta | 7 + .../TemplateData/progress-bar-full-light.png | Bin 0 -> 84 bytes .../progress-bar-full-light.png.meta | 7 + .../RPMTemplate/TemplateData/style.css | 39 + .../RPMTemplate/TemplateData/style.css.meta | 7 + .../TemplateData/unity-logo-dark.png | Bin 0 -> 1108 bytes .../TemplateData/unity-logo-dark.png.meta | 7 + .../TemplateData/unity-logo-light.png | Bin 0 -> 1108 bytes .../TemplateData/unity-logo-light.png.meta | 7 + .../RPMTemplate/TemplateData/webgl-logo.png | Bin 0 -> 2031 bytes .../TemplateData/webgl-logo.png.meta | 7 + .../WebGLTemplates/RPMTemplate/index.html | 40 + .../RPMTemplate/index.html.meta | 7 + .../WebGLTemplates/RPMTemplate/thumbnail.png | Bin 0 -> 5284 bytes .../RPMTemplate/thumbnail.png.meta | 7 + Samples~/WebGLExample/WebGlHelper.meta | 8 + .../WebGLExample/WebGlHelper/WebHelper.jslib | 19 + .../WebGlHelper/WebHelper.jslib.meta | 76 ++ 81 files changed, 2567 insertions(+) create mode 100644 Samples~/WebGLExample.meta create mode 100644 Samples~/WebGLExample/Editor.meta create mode 100644 Samples~/WebGLExample/Editor/EditorWindows.meta create mode 100644 Samples~/WebGLExample/Editor/EditorWindows/ExampleSetup.cs create mode 100644 Samples~/WebGLExample/Editor/EditorWindows/ExampleSetup.cs.meta create mode 100644 Samples~/WebGLExample/Editor/EditorWindows/SetupTemplate.meta create mode 100644 Samples~/WebGLExample/Editor/EditorWindows/SetupTemplate/SetupWebGLTemplate.cs create mode 100644 Samples~/WebGLExample/Editor/EditorWindows/SetupTemplate/SetupWebGLTemplate.cs.meta create mode 100644 Samples~/WebGLExample/Editor/EditorWindows/SetupTemplate/SetupWebGLTemplate.uxml create mode 100644 Samples~/WebGLExample/Editor/EditorWindows/SetupTemplate/SetupWebGLTemplate.uxml.meta create mode 100644 Samples~/WebGLExample/Editor/ReadyPlayerMe.Core.WebGLExample.Editor.asmdef create mode 100644 Samples~/WebGLExample/Editor/ReadyPlayerMe.Core.WebGLExample.Editor.asmdef.meta create mode 100644 Samples~/WebGLExample/Prefabs.meta create mode 100644 Samples~/WebGLExample/Prefabs/DebugPanel.prefab create mode 100644 Samples~/WebGLExample/Prefabs/DebugPanel.prefab.meta create mode 100644 Samples~/WebGLExample/Ready Player Me.meta create mode 100644 Samples~/WebGLExample/Ready Player Me/Resources.meta create mode 100644 Samples~/WebGLExample/Ready Player Me/Resources/Settings.meta create mode 100644 Samples~/WebGLExample/Ready Player Me/Resources/Settings/AvatarLoaderSettings.asset create mode 100644 Samples~/WebGLExample/Ready Player Me/Resources/Settings/AvatarLoaderSettings.asset.meta create mode 100644 Samples~/WebGLExample/Ready Player Me/Resources/Settings/CoreSettings.asset create mode 100644 Samples~/WebGLExample/Ready Player Me/Resources/Settings/CoreSettings.asset.meta create mode 100644 Samples~/WebGLExample/ReadyPlayerMe.Core.WebGLExample.asmdef create mode 100644 Samples~/WebGLExample/ReadyPlayerMe.Core.WebGLExample.asmdef.meta create mode 100644 Samples~/WebGLExample/Scenes.meta create mode 100644 Samples~/WebGLExample/Scenes/WebGLExample.unity create mode 100644 Samples~/WebGLExample/Scenes/WebGLExample.unity.meta create mode 100644 Samples~/WebGLExample/Scenes/WebGLExampleSettings.lighting create mode 100644 Samples~/WebGLExample/Scenes/WebGLExampleSettings.lighting.meta create mode 100644 Samples~/WebGLExample/Scripts.meta create mode 100644 Samples~/WebGLExample/Scripts/DebugLogger.cs create mode 100644 Samples~/WebGLExample/Scripts/DebugLogger.cs.meta create mode 100644 Samples~/WebGLExample/Scripts/DemoCanvas.cs create mode 100644 Samples~/WebGLExample/Scripts/DemoCanvas.cs.meta create mode 100644 Samples~/WebGLExample/Scripts/WebFrameHandler.cs create mode 100644 Samples~/WebGLExample/Scripts/WebFrameHandler.cs.meta create mode 100644 Samples~/WebGLExample/Scripts/WebGLAvatarLoader.cs create mode 100644 Samples~/WebGLExample/Scripts/WebGLAvatarLoader.cs.meta create mode 100644 Samples~/WebGLExample/Scripts/WebInterface.cs create mode 100644 Samples~/WebGLExample/Scripts/WebInterface.cs.meta create mode 100644 Samples~/WebGLExample/WebGLTemplates.meta create mode 100644 Samples~/WebGLExample/WebGLTemplates/RPMTemplate.meta create mode 100644 Samples~/WebGLExample/WebGLTemplates/RPMTemplate/TemplateData.meta create mode 100644 Samples~/WebGLExample/WebGLTemplates/RPMTemplate/TemplateData/Global.js create mode 100644 Samples~/WebGLExample/WebGLTemplates/RPMTemplate/TemplateData/Global.js.meta create mode 100644 Samples~/WebGLExample/WebGLTemplates/RPMTemplate/TemplateData/ReadyPlayerMe.meta create mode 100644 Samples~/WebGLExample/WebGLTemplates/RPMTemplate/TemplateData/ReadyPlayerMe/ReadyPlayerMeFrame.js create mode 100644 Samples~/WebGLExample/WebGLTemplates/RPMTemplate/TemplateData/ReadyPlayerMe/ReadyPlayerMeFrame.js.meta create mode 100644 Samples~/WebGLExample/WebGLTemplates/RPMTemplate/TemplateData/ReadyPlayerMe/RpmGlobal.js create mode 100644 Samples~/WebGLExample/WebGLTemplates/RPMTemplate/TemplateData/ReadyPlayerMe/RpmGlobal.js.meta create mode 100644 Samples~/WebGLExample/WebGLTemplates/RPMTemplate/TemplateData/ReadyPlayerMe/RpmStyle.css create mode 100644 Samples~/WebGLExample/WebGLTemplates/RPMTemplate/TemplateData/ReadyPlayerMe/RpmStyle.css.meta create mode 100644 Samples~/WebGLExample/WebGLTemplates/RPMTemplate/TemplateData/UnitySetup.js create mode 100644 Samples~/WebGLExample/WebGLTemplates/RPMTemplate/TemplateData/UnitySetup.js.meta create mode 100644 Samples~/WebGLExample/WebGLTemplates/RPMTemplate/TemplateData/favicon.ico create mode 100644 Samples~/WebGLExample/WebGLTemplates/RPMTemplate/TemplateData/favicon.ico.meta create mode 100644 Samples~/WebGLExample/WebGLTemplates/RPMTemplate/TemplateData/fullscreen-button.png create mode 100644 Samples~/WebGLExample/WebGLTemplates/RPMTemplate/TemplateData/fullscreen-button.png.meta create mode 100644 Samples~/WebGLExample/WebGLTemplates/RPMTemplate/TemplateData/progress-bar-empty-dark.png create mode 100644 Samples~/WebGLExample/WebGLTemplates/RPMTemplate/TemplateData/progress-bar-empty-dark.png.meta create mode 100644 Samples~/WebGLExample/WebGLTemplates/RPMTemplate/TemplateData/progress-bar-empty-light.png create mode 100644 Samples~/WebGLExample/WebGLTemplates/RPMTemplate/TemplateData/progress-bar-empty-light.png.meta create mode 100644 Samples~/WebGLExample/WebGLTemplates/RPMTemplate/TemplateData/progress-bar-full-dark.png create mode 100644 Samples~/WebGLExample/WebGLTemplates/RPMTemplate/TemplateData/progress-bar-full-dark.png.meta create mode 100644 Samples~/WebGLExample/WebGLTemplates/RPMTemplate/TemplateData/progress-bar-full-light.png create mode 100644 Samples~/WebGLExample/WebGLTemplates/RPMTemplate/TemplateData/progress-bar-full-light.png.meta create mode 100644 Samples~/WebGLExample/WebGLTemplates/RPMTemplate/TemplateData/style.css create mode 100644 Samples~/WebGLExample/WebGLTemplates/RPMTemplate/TemplateData/style.css.meta create mode 100644 Samples~/WebGLExample/WebGLTemplates/RPMTemplate/TemplateData/unity-logo-dark.png create mode 100644 Samples~/WebGLExample/WebGLTemplates/RPMTemplate/TemplateData/unity-logo-dark.png.meta create mode 100644 Samples~/WebGLExample/WebGLTemplates/RPMTemplate/TemplateData/unity-logo-light.png create mode 100644 Samples~/WebGLExample/WebGLTemplates/RPMTemplate/TemplateData/unity-logo-light.png.meta create mode 100644 Samples~/WebGLExample/WebGLTemplates/RPMTemplate/TemplateData/webgl-logo.png create mode 100644 Samples~/WebGLExample/WebGLTemplates/RPMTemplate/TemplateData/webgl-logo.png.meta create mode 100644 Samples~/WebGLExample/WebGLTemplates/RPMTemplate/index.html create mode 100644 Samples~/WebGLExample/WebGLTemplates/RPMTemplate/index.html.meta create mode 100644 Samples~/WebGLExample/WebGLTemplates/RPMTemplate/thumbnail.png create mode 100644 Samples~/WebGLExample/WebGLTemplates/RPMTemplate/thumbnail.png.meta create mode 100644 Samples~/WebGLExample/WebGlHelper.meta create mode 100644 Samples~/WebGLExample/WebGlHelper/WebHelper.jslib create mode 100644 Samples~/WebGLExample/WebGlHelper/WebHelper.jslib.meta diff --git a/Samples~/WebGLExample.meta b/Samples~/WebGLExample.meta new file mode 100644 index 00000000..5e464b61 --- /dev/null +++ b/Samples~/WebGLExample.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3967a857eed2a264bb84ede74ba18794 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Samples~/WebGLExample/Editor.meta b/Samples~/WebGLExample/Editor.meta new file mode 100644 index 00000000..bd02ce8f --- /dev/null +++ b/Samples~/WebGLExample/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 884e8dd9b9df1104a8aa5063a88a822e +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Samples~/WebGLExample/Editor/EditorWindows.meta b/Samples~/WebGLExample/Editor/EditorWindows.meta new file mode 100644 index 00000000..e162b92a --- /dev/null +++ b/Samples~/WebGLExample/Editor/EditorWindows.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: de6f501ae1f74c64fa65b39369670d54 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Samples~/WebGLExample/Editor/EditorWindows/ExampleSetup.cs b/Samples~/WebGLExample/Editor/EditorWindows/ExampleSetup.cs new file mode 100644 index 00000000..4fafb14a --- /dev/null +++ b/Samples~/WebGLExample/Editor/EditorWindows/ExampleSetup.cs @@ -0,0 +1,21 @@ +using ReadyPlayerMe.Samples; +using UnityEditor; +using UnityEngine; + +namespace ReadyPlayerMe.Samples +{ + public static class ExampleSetup + { + private static readonly string RPM_WEBGL_SCREEN_SHOWN_KEY = "rpm-webgl-screen-shown"; + + [InitializeOnLoadMethod] + private static void InitializeOnLoad() + { + if (!ProjectPrefs.GetBool(RPM_WEBGL_SCREEN_SHOWN_KEY)) + { + ProjectPrefs.SetBool(RPM_WEBGL_SCREEN_SHOWN_KEY, true); + SetupWebGLTemplate.ShowWindow(); + } + } + } +} diff --git a/Samples~/WebGLExample/Editor/EditorWindows/ExampleSetup.cs.meta b/Samples~/WebGLExample/Editor/EditorWindows/ExampleSetup.cs.meta new file mode 100644 index 00000000..d9bba435 --- /dev/null +++ b/Samples~/WebGLExample/Editor/EditorWindows/ExampleSetup.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 6ee623cd88d74767bd0996708cb77b48 +timeCreated: 1693905094 \ No newline at end of file diff --git a/Samples~/WebGLExample/Editor/EditorWindows/SetupTemplate.meta b/Samples~/WebGLExample/Editor/EditorWindows/SetupTemplate.meta new file mode 100644 index 00000000..0f4be0f7 --- /dev/null +++ b/Samples~/WebGLExample/Editor/EditorWindows/SetupTemplate.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 93d985bf54e34839a5c93a2bbc7a1e89 +timeCreated: 1693834397 \ No newline at end of file diff --git a/Samples~/WebGLExample/Editor/EditorWindows/SetupTemplate/SetupWebGLTemplate.cs b/Samples~/WebGLExample/Editor/EditorWindows/SetupTemplate/SetupWebGLTemplate.cs new file mode 100644 index 00000000..2408f9b0 --- /dev/null +++ b/Samples~/WebGLExample/Editor/EditorWindows/SetupTemplate/SetupWebGLTemplate.cs @@ -0,0 +1,108 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using UnityEditor; +using UnityEngine; +using UnityEngine.UIElements; + +namespace ReadyPlayerMe.Samples +{ + public class SetupWebGLTemplate : EditorWindow + { + private string destinationPath; + private string sourcePath; + + private const string TITLE = "RPM WebGL"; + + private const string CONFIRM_BUTTON = "ConfirmButton"; + private const string CANCEL_BUTTON = "CancelButton"; + [SerializeField] private VisualTreeAsset visualTreeAsset; + [SerializeField] private GameObject folder; + + public static void ShowWindow() + { + var window = GetWindow(); + } + + private void CreateGUI() + { + this.titleContent = new GUIContent(TITLE); + this.minSize = new Vector2(350, 120); + this.maxSize = new Vector2(350, 120); + visualTreeAsset.CloneTree(rootVisualElement); + var confirm = rootVisualElement.Q + + + + +
+ +
+
+
+
+
+ + + + + + + + diff --git a/Samples~/WebGLExample/WebGLTemplates/RPMTemplate/index.html.meta b/Samples~/WebGLExample/WebGLTemplates/RPMTemplate/index.html.meta new file mode 100644 index 00000000..3be6f496 --- /dev/null +++ b/Samples~/WebGLExample/WebGLTemplates/RPMTemplate/index.html.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: fff559cd71c523e4e8dc2789cda60da3 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Samples~/WebGLExample/WebGLTemplates/RPMTemplate/thumbnail.png b/Samples~/WebGLExample/WebGLTemplates/RPMTemplate/thumbnail.png new file mode 100644 index 0000000000000000000000000000000000000000..5d359dafa26a111c9040fdd687966070549daf47 GIT binary patch literal 5284 zcmb7nXE5Af*!FMrZWEnI2+^{-5WTD}qDPNz^%jX1tf)csE~`clf*|@LIxC1Mt3>ZB z>L%*5|L5cTet74-XRdS4oS8Fc?(3X$-Pd`q`&^BZjF}7o07?yYWqn+R{|6F0-1yAm z{39-rda0Yf0s#6){{f_-&-n)c$aI{cP+eUoPhZbhPM%(D8c-;kmyf5Tvzr3|_|GE@ zV1@=e^s?BcQzfk!c$$`{J{<|0zET{VHkpf$ofNDY!(KQ?r`LT)MTLN6upkCMApssw zrw5^kC7UH)XD>FzFY|^cKy|k-5k4VoRQo5e1d2gCq|M`WT=bkJ%LkHDBZvF zJAB}K|H`_6LKqpR7XT({uxEdD%>e@bhRDb~euyOQ1VH{%9 z1djkAeUqPRk-%vIg}?-*Qb0i!1V?0X82|+Yfc1!-?HZuV4_I@DZcYJk#NX^75MZ9h zP6sMT2H0pEVw3?VY2fqti&z!FLes5x9V}biTC=G_kwBj~+ zHaQ9cJptKFB4J|GzfVR1pdgtJSMABQKZ>dbg%VF_qO#)O?IOB;XluK6voT)fr2qgc zz9ADg5Wxm!xHJ*m{if&ul1b=_`jGjI#xi_9d8ezMznW%QvOn!UC zI`#0ohHZ-pAMKjnUGD_tocI%wl85h=Qh56wP2SqCE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q~_-DmqRJTp#J;p+sVt za7y`~TK*q^bKXf(Zj;Mb1ThAW!as4M3JT%gI3+48V~Hx<3xv>%=J!=qR@UroK2XoF zJ8GG0Xqn(4vxi-^%zO18 zn~nHK`qjRcb)|jK=Zm$yW$0+e?;ffUNQAkF75QIcS|{}%DX#i2@sZp2U0hs3IvunWF|P)4%r-q|y*5idRZ5GWfO+G?fOYFbb<>O~6ukS3pms8v zw(%^)-T=dy$4H|H0AQ{cmjBSB`wLf0qNaIAZ(c7_@&>d_MH3NEmVR1hI+xuFxN+Qi zJ(Oo#7t^)W5x4cU0B9ArY@&*^MdFQk9nDM+n9$++)r%U7IW#(G`$ysRCD!ltYf9?> z4NA)3^Enu<4dFTnKkj8WxtrVBtu1w23gkIoEiO9MK=K$3FF5J~cz+$E3Y#6jX^FC8 zsHHJ!C=W*F>Ib?ZB4Z$c;^Z_giK$-0L+9XutCYvvrRmorewRx%RyVu)d+DbXI+c*- zWhZRn=G()*qIa0Lxnq(~-?9LV2}q}i8@Ho4SYY#Y2ZI~l<QsJ|0*(svw?ty%5&u!CF^(p E0~Nm1RR910 literal 0 HcmV?d00001 diff --git a/Samples~/WebGLExample/WebGLTemplates/RPMTemplate/thumbnail.png.meta b/Samples~/WebGLExample/WebGLTemplates/RPMTemplate/thumbnail.png.meta new file mode 100644 index 00000000..bedc9aea --- /dev/null +++ b/Samples~/WebGLExample/WebGLTemplates/RPMTemplate/thumbnail.png.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 782887ed67f6e494bbc52ba795812eda +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Samples~/WebGLExample/WebGlHelper.meta b/Samples~/WebGLExample/WebGlHelper.meta new file mode 100644 index 00000000..30f1256d --- /dev/null +++ b/Samples~/WebGLExample/WebGlHelper.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 749d820316be6a248a628daea6dc6b39 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Samples~/WebGLExample/WebGlHelper/WebHelper.jslib b/Samples~/WebGLExample/WebGlHelper/WebHelper.jslib new file mode 100644 index 00000000..94a1ad4c --- /dev/null +++ b/Samples~/WebGLExample/WebGlHelper/WebHelper.jslib @@ -0,0 +1,19 @@ +mergeInto(LibraryManager.library, { + + ShowReadyPlayerMeFrame: function () { + showRpm(); + }, + + HideReadyPlayerMeFrame: function () { + hideRpm(); + }, + + SetupRpm: function (url, targetGameObjectName){ + setupRpmFrame(UTF8ToString(url), UTF8ToString(targetGameObjectName)); + }, + + ReloadUrl: function (url){ + reloadUrl(UTF8ToString(url)); + } + +}); \ No newline at end of file diff --git a/Samples~/WebGLExample/WebGlHelper/WebHelper.jslib.meta b/Samples~/WebGLExample/WebGlHelper/WebHelper.jslib.meta new file mode 100644 index 00000000..220a9838 --- /dev/null +++ b/Samples~/WebGLExample/WebGlHelper/WebHelper.jslib.meta @@ -0,0 +1,76 @@ +fileFormatVersion: 2 +guid: 742ed465b82d85f4cb68fa4821e9710d +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 1 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + : Any + second: + enabled: 0 + settings: + Exclude Android: 1 + Exclude Editor: 1 + Exclude Linux64: 1 + Exclude OSXUniversal: 1 + Exclude WebGL: 0 + Exclude Win: 1 + Exclude Win64: 1 + - first: + Android: Android + second: + enabled: 0 + settings: + CPU: ARMv7 + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + CPU: AnyCPU + DefaultValueInitialized: true + OS: AnyOS + - first: + Standalone: Linux64 + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: OSXUniversal + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: Win + second: + enabled: 0 + settings: + CPU: x86 + - first: + Standalone: Win64 + second: + enabled: 0 + settings: + CPU: x86_64 + - first: + WebGL: WebGL + second: + enabled: 1 + settings: {} + userData: + assetBundleName: + assetBundleVariant: From 87c7301191ce8418d7f326f6d3269d55ca519584 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Raigo=20K=C3=B5vask?= Date: Thu, 7 Sep 2023 09:26:36 +0300 Subject: [PATCH 2/5] chore: update package and get template from the same folder as the script is in --- .../Editor/EditorWindows/ExampleSetup.cs | 16 +++++-- .../SetupTemplate/SetupWebGLTemplate.cs | 42 +++++++++++++++++-- package.json | 5 +++ 3 files changed, 55 insertions(+), 8 deletions(-) diff --git a/Samples~/WebGLExample/Editor/EditorWindows/ExampleSetup.cs b/Samples~/WebGLExample/Editor/EditorWindows/ExampleSetup.cs index 4fafb14a..021581bd 100644 --- a/Samples~/WebGLExample/Editor/EditorWindows/ExampleSetup.cs +++ b/Samples~/WebGLExample/Editor/EditorWindows/ExampleSetup.cs @@ -7,15 +7,23 @@ namespace ReadyPlayerMe.Samples public static class ExampleSetup { private static readonly string RPM_WEBGL_SCREEN_SHOWN_KEY = "rpm-webgl-screen-shown"; - + private static bool HasShownScreen = false; [InitializeOnLoadMethod] private static void InitializeOnLoad() { - if (!ProjectPrefs.GetBool(RPM_WEBGL_SCREEN_SHOWN_KEY)) + if (ProjectPrefs.GetBool(RPM_WEBGL_SCREEN_SHOWN_KEY)) { - ProjectPrefs.SetBool(RPM_WEBGL_SCREEN_SHOWN_KEY, true); - SetupWebGLTemplate.ShowWindow(); + return; } + + ProjectPrefs.SetBool(RPM_WEBGL_SCREEN_SHOWN_KEY, true); + EditorApplication.update += ShowWebGLScreen; + } + + private static void ShowWebGLScreen() + { + SetupWebGLTemplate.ShowWindow(); + EditorApplication.update -= ShowWebGLScreen; } } } diff --git a/Samples~/WebGLExample/Editor/EditorWindows/SetupTemplate/SetupWebGLTemplate.cs b/Samples~/WebGLExample/Editor/EditorWindows/SetupTemplate/SetupWebGLTemplate.cs index 2408f9b0..6e6701cd 100644 --- a/Samples~/WebGLExample/Editor/EditorWindows/SetupTemplate/SetupWebGLTemplate.cs +++ b/Samples~/WebGLExample/Editor/EditorWindows/SetupTemplate/SetupWebGLTemplate.cs @@ -18,18 +18,52 @@ public class SetupWebGLTemplate : EditorWindow private const string CONFIRM_BUTTON = "ConfirmButton"; private const string CANCEL_BUTTON = "CancelButton"; [SerializeField] private VisualTreeAsset visualTreeAsset; - [SerializeField] private GameObject folder; + private VisualTreeAsset GetVisualTreeAsset() + { + MonoScript script = MonoScript.FromScriptableObject(this); + + if (script != null) + { + string scriptPath = AssetDatabase.GetAssetPath(script); + + if (!string.IsNullOrEmpty(scriptPath)) + { + string folderPath = System.IO.Path.GetDirectoryName(scriptPath); + string visualTreeAssetPath = folderPath + "/" + script.name + ".uxml"; + + VisualTreeAsset visualTreeAsset = AssetDatabase.LoadAssetAtPath(visualTreeAssetPath); + + return visualTreeAsset; + } + else + { + Debug.LogError("Script path is empty."); + } + } + else + { + Debug.LogError("MonoScript not found for this script."); + } + return null; + } + public static void ShowWindow() { var window = GetWindow(); + window.titleContent = new GUIContent(TITLE); + window.minSize = new Vector2(350, 120); + window.maxSize = new Vector2(350, 120); } private void CreateGUI() { - this.titleContent = new GUIContent(TITLE); - this.minSize = new Vector2(350, 120); - this.maxSize = new Vector2(350, 120); + visualTreeAsset = GetVisualTreeAsset(); + if (!visualTreeAsset) + { + this.Close(); + return; + } visualTreeAsset.CloneTree(rootVisualElement); var confirm = rootVisualElement.Q