From 1a1562e87e0b3b674fb35cb09a76c1a13c8b87e7 Mon Sep 17 00:00:00 2001 From: shane Date: Mon, 23 Dec 2024 11:09:00 +0100 Subject: [PATCH 01/11] added a try catch around stuff and converted nulls to 0 for ints, checking that texture url is a url --- Runtime/Scripts/Scene/BanterScene.cs | 26 ++++++++++++------- .../Scene/Components/BanterMaterial.cs | 2 +- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/Runtime/Scripts/Scene/BanterScene.cs b/Runtime/Scripts/Scene/BanterScene.cs index 7310030a..fe0084b3 100644 --- a/Runtime/Scripts/Scene/BanterScene.cs +++ b/Runtime/Scripts/Scene/BanterScene.cs @@ -868,14 +868,19 @@ public void SetJsObjectActive(string msg, int reqId) Debug.LogError("[Banter] SetJsObjectActive message is malformed: " + msg); return; } - var banterObject = GetGameObject(int.Parse(msgParts[0])); - if (banterObject != null) - { - UnityMainThreadTaskScheduler.Default.Enqueue(() => - { - banterObject.SetActive(int.Parse(msgParts[1]) == 1); - SendObjectUpdate(banterObject, reqId); - }); + try{ + var banterObject = GetGameObject(int.Parse(msgParts[0])); + if (banterObject != null) + { + UnityMainThreadTaskScheduler.Default.Enqueue(() => + { + banterObject.SetActive(int.Parse(msgParts[1]) == 1); + SendObjectUpdate(banterObject, reqId); + }); + } + }catch(Exception ex){ + Debug.LogError("SetJsObjectActive threw an exception: " +msg); + Debug.LogException(ex); } } public void SetJsObjectLayer(string msg, int reqId) @@ -1048,6 +1053,9 @@ private List SetComponentProperties(int startIndex, string[] parts, Bant banterComp.UpdateProperty(name, valFloat); break; case PropertyType.Int: + if(propParts[2].Equals("null")) { + propParts[2] = "0"; + } var valInt = int.Parse(propParts[2]); updates.Add(new BanterInt() { n = name, x = valInt }); banterComp.UpdateProperty(name, valInt); @@ -1079,7 +1087,7 @@ private List SetComponentProperties(int startIndex, string[] parts, Bant } catch (Exception e) { - Debug.LogError("[Banter] Error setting property: " + e.Message + ": " + msg); + Debug.LogError("[Banter] Error setting property: " + name + " " + type + " " + e.Message + ": " + msg); } } return updates; diff --git a/Runtime/Scripts/Scene/Components/BanterMaterial.cs b/Runtime/Scripts/Scene/Components/BanterMaterial.cs index 07f96ede..4ce90c4a 100644 --- a/Runtime/Scripts/Scene/Components/BanterMaterial.cs +++ b/Runtime/Scripts/Scene/Components/BanterMaterial.cs @@ -102,7 +102,7 @@ public async Task SetTexture(string texture) { try { - if (!scene.settings.EnableDefaultTextures && string.IsNullOrEmpty(texture)) + if ((!scene.settings.EnableDefaultTextures && string.IsNullOrEmpty(texture)) || !Uri.IsWellFormedUriString(texture, UriKind.Absolute)) { return; } From db30d7256907d2f5a671fbcc76bde219557d7487 Mon Sep 17 00:00:00 2001 From: shane Date: Mon, 23 Dec 2024 11:22:21 +0100 Subject: [PATCH 02/11] made it wait to load the space image again --- Runtime/Scripts/Scene/BanterScene.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Runtime/Scripts/Scene/BanterScene.cs b/Runtime/Scripts/Scene/BanterScene.cs index 5fa39426..21ef855d 100644 --- a/Runtime/Scripts/Scene/BanterScene.cs +++ b/Runtime/Scripts/Scene/BanterScene.cs @@ -1336,7 +1336,7 @@ public async Task LoadUrl(string url, bool isLoadingOpen = false) { return; } - _ = ShowSpaceImage(url); + await ShowSpaceImage(url); await ResetScene(); await link.LoadUrl(url); await new WaitUntil(() => loaded); From f9df744c4e691d96f3af080d41b5c16d9134c196 Mon Sep 17 00:00:00 2001 From: shane Date: Mon, 23 Dec 2024 12:10:25 +0100 Subject: [PATCH 03/11] added logging around loading --- Runtime/Scripts/Scene/BanterScene.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Runtime/Scripts/Scene/BanterScene.cs b/Runtime/Scripts/Scene/BanterScene.cs index 21ef855d..d22a1042 100644 --- a/Runtime/Scripts/Scene/BanterScene.cs +++ b/Runtime/Scripts/Scene/BanterScene.cs @@ -1336,10 +1336,15 @@ public async Task LoadUrl(string url, bool isLoadingOpen = false) { return; } + LogLine.Do("[BanterScene] Loading ShowSpaceImage: " + url); await ShowSpaceImage(url); + LogLine.Do("[BanterScene] Loading ResetScene: " + url); await ResetScene(); + LogLine.Do("[BanterScene] Loading LoadUrl: " + url); await link.LoadUrl(url); + LogLine.Do("[BanterScene] Loading WaitUntil: " + url); await new WaitUntil(() => loaded); + LogLine.Do("[BanterScene] Loading after WaitUntil: " + url); LoadingStatus = "Please wait, loading live space..."; if (HasLoadFailed()) { @@ -1351,7 +1356,11 @@ public async Task LoadUrl(string url, bool isLoadingOpen = false) { events.OnUnitySceneLoad.Invoke(url); }); + LogLine.Do("[BanterScene] Loading Task.Delay(2500): " + url); + await Task.Delay(2500); + LogLine.Do("[BanterScene] Loading loadingManager?.LoadOut: " + url); + await loadingManager?.LoadOut(); loading = false; }); From 649d5c0fbe71c3f4b998f989f5af685146dd7a6a Mon Sep 17 00:00:00 2001 From: brian91292 <8050523+brian91292@users.noreply.github.com> Date: Mon, 23 Dec 2024 09:33:47 -0600 Subject: [PATCH 04/11] handle all main thread tasks every frame instead of limiting it by time/number of tasks --- Runtime/Scripts/3rdParty/BSIPA/UnityMainThreadTaskScheduler.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Runtime/Scripts/3rdParty/BSIPA/UnityMainThreadTaskScheduler.cs b/Runtime/Scripts/3rdParty/BSIPA/UnityMainThreadTaskScheduler.cs index 4385b1a3..32e0f296 100644 --- a/Runtime/Scripts/3rdParty/BSIPA/UnityMainThreadTaskScheduler.cs +++ b/Runtime/Scripts/3rdParty/BSIPA/UnityMainThreadTaskScheduler.cs @@ -157,8 +157,7 @@ public IEnumerator Coroutine() { var yieldAfter = YieldAfterTasks; sw.Start(); - for (int i = 0; i < yieldAfter && !tasks.IsEmpty - && sw.Elapsed < YieldAfterTime; i++) + for (int i = 0; i < tasks.Count; i++) { QueueItem task; do if (!tasks.TryDequeue(out task)) goto exit; // try dequeue, if we can't exit From fbe644a25a16842a50e76f35567164df1999d36e Mon Sep 17 00:00:00 2001 From: Mike Nisbet Date: Mon, 6 Jan 2025 18:49:10 +0000 Subject: [PATCH 05/11] WIP --- .github/workflows/publish.yml | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 5a5b532f..3f57d78f 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -19,22 +19,36 @@ jobs: TAG=$(jq -r '.version' package.json) echo "TAG=$TAG" >> $GITHUB_ENV if git rev-parse $TAG >/dev/null 2>&1; then - echo "TAG_EXISTS=true" >> $GITHUB_ENV + echo ""::error::Tag already exists: $TAG" else echo "TAG_EXISTS=false" >> $GITHUB_ENV fi - - name: Samples to Samples~ + - name: Publish on UPM branch run: | if [[ -d "Samples" ]]; then git mv Samples Samples~ rm -f Samples.meta - git config --global user.name 'github-bot' - git config --global user.email 'github-bot@users.noreply.github.com' - git commit -am "fix: Samples => Samples~" - git push -u origin main fi + mkdir ../upm + cp -r . ../upm + rm -rf ../upm/.git # don't want to replace git history! + + # WORKING UP TO HERE!! + + git reset --hard HEAD + git checkout upm + cp -r ../upm/* . + + rm -rf ../upm + + git add . + git config --global user.name 'github-bot' + git config --global user.email 'github-bot@users.noreply.github.com' + git commit -m "$TAG" --no-verify + git push -u origin upm + - name: Create Release if: env.TAG_EXISTS == 'false' run: | From 4966f383fc0a8db295e9de58303ac27a7c4f9c2a Mon Sep 17 00:00:00 2001 From: Mike Nisbet Date: Tue, 7 Jan 2025 10:47:34 +0000 Subject: [PATCH 06/11] push right tag --- .github/workflows/publish.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 3f57d78f..83b820b2 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -35,22 +35,19 @@ jobs: cp -r . ../upm rm -rf ../upm/.git # don't want to replace git history! - # WORKING UP TO HERE!! - git reset --hard HEAD git checkout upm - cp -r ../upm/* . + cp -r ../upm/* . rm -rf ../upm - git add . git config --global user.name 'github-bot' git config --global user.email 'github-bot@users.noreply.github.com' - git commit -m "$TAG" --no-verify + git commit -am "$TAG" --no-verify git push -u origin upm - name: Create Release if: env.TAG_EXISTS == 'false' run: | - git tag ${{ env.TAG }} main + git tag ${{ env.TAG }} upm git push origin --tags From e49ebb784bd3b01fdfec9fcff4c29735c17962f2 Mon Sep 17 00:00:00 2001 From: Mike Nisbet Date: Tue, 7 Jan 2025 10:49:56 +0000 Subject: [PATCH 07/11] lint --- Runtime/Scripts/Scene/BanterScene.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Runtime/Scripts/Scene/BanterScene.cs b/Runtime/Scripts/Scene/BanterScene.cs index d22a1042..c48167a7 100644 --- a/Runtime/Scripts/Scene/BanterScene.cs +++ b/Runtime/Scripts/Scene/BanterScene.cs @@ -870,7 +870,8 @@ public void SetJsObjectActive(string msg, int reqId) Debug.LogError("[Banter] SetJsObjectActive message is malformed: " + msg); return; } - try{ + try + { var banterObject = GetGameObject(int.Parse(msgParts[0])); if (banterObject != null) { @@ -880,8 +881,10 @@ public void SetJsObjectActive(string msg, int reqId) SendObjectUpdate(banterObject, reqId); }); } - }catch(Exception ex){ - Debug.LogError("SetJsObjectActive threw an exception: " +msg); + } + catch (Exception ex) + { + Debug.LogError("SetJsObjectActive threw an exception: " + msg); Debug.LogException(ex); } } @@ -1055,7 +1058,8 @@ private List SetComponentProperties(int startIndex, string[] parts, Bant banterComp.UpdateProperty(name, valFloat); break; case PropertyType.Int: - if(propParts[2].Equals("null")) { + if (propParts[2].Equals("null")) + { propParts[2] = "0"; } var valInt = int.Parse(propParts[2]); From e8147e3e05115cbc423cf9dec883305e328a6cb0 Mon Sep 17 00:00:00 2001 From: Mike Nisbet Date: Tue, 7 Jan 2025 11:06:54 +0000 Subject: [PATCH 08/11] missed quote --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 83b820b2..9bcb76d4 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -19,7 +19,7 @@ jobs: TAG=$(jq -r '.version' package.json) echo "TAG=$TAG" >> $GITHUB_ENV if git rev-parse $TAG >/dev/null 2>&1; then - echo ""::error::Tag already exists: $TAG" + echo "::error::Tag already exists: $TAG" else echo "TAG_EXISTS=false" >> $GITHUB_ENV fi From ebd14ee72e83be9ff01f6f51aef2011bf96ebedd Mon Sep 17 00:00:00 2001 From: Mike Nisbet Date: Tue, 7 Jan 2025 11:11:22 +0000 Subject: [PATCH 09/11] version bump --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 480e601e..c04f225e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "com.sidequest.banter", - "version": "2.5.1", + "version": "2.6.0", "displayName": "Banter SDK", "description": "This Module contains the Banter SDK used for building spaces in the bantaverse.", "unity": "2022.3", From 2ddfb3f3992f0117213052e1c250ad30349b8301 Mon Sep 17 00:00:00 2001 From: Mike Nisbet Date: Tue, 7 Jan 2025 11:14:02 +0000 Subject: [PATCH 10/11] exit early on existing tag --- .github/workflows/publish.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 9bcb76d4..f84fabcb 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -20,6 +20,7 @@ jobs: echo "TAG=$TAG" >> $GITHUB_ENV if git rev-parse $TAG >/dev/null 2>&1; then echo "::error::Tag already exists: $TAG" + exit 1 else echo "TAG_EXISTS=false" >> $GITHUB_ENV fi From ef902567fb6ae237fa3fa71d6eefbe682bb50c43 Mon Sep 17 00:00:00 2001 From: Mike Nisbet Date: Tue, 7 Jan 2025 11:16:26 +0000 Subject: [PATCH 11/11] actually test on a patch release --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c04f225e..008a2a5e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "com.sidequest.banter", - "version": "2.6.0", + "version": "2.5.2", "displayName": "Banter SDK", "description": "This Module contains the Banter SDK used for building spaces in the bantaverse.", "unity": "2022.3",