-
Notifications
You must be signed in to change notification settings - Fork 2
Dev #159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Dev #159
Changes from all commits
404750b
e4d385c
21f4424
270a738
850e441
c4d8e5f
b99079b
6be9991
d10d511
42be543
5a3055a
ca17f80
db5fb8c
17398a3
8d37280
986b8b2
7da2b72
a0a2ad9
0ceb014
9638046
eb30da5
1f7e822
d415c90
5b37806
c0d2d08
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,6 +1,9 @@ | ||||||||||||||||||||||||||||||||||||||||||||
| using UnityEngine; | ||||||||||||||||||||||||||||||||||||||||||||
| using UnityEditor; | ||||||||||||||||||||||||||||||||||||||||||||
| using Banter.SDK; | ||||||||||||||||||||||||||||||||||||||||||||
| using System.IO; | ||||||||||||||||||||||||||||||||||||||||||||
| using UnityEditor.PackageManager; | ||||||||||||||||||||||||||||||||||||||||||||
| using UnityEditor.PackageManager.Requests; | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| namespace Banter.SDKEditor | ||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -27,5 +30,43 @@ static void CreateBanterStarterUpper(MenuCommand menuCommand) | |||||||||||||||||||||||||||||||||||||||||||
| Undo.RegisterCreatedObjectUndo(go, "Create " + go.name); | ||||||||||||||||||||||||||||||||||||||||||||
| Selection.activeObject = go; | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| #if !BANTER_EDITOR | ||||||||||||||||||||||||||||||||||||||||||||
| [MenuItem("Banter/Uninstall SDK")] | ||||||||||||||||||||||||||||||||||||||||||||
| static void UninstallBanter() | ||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||
| bool userResponse = EditorUtility.DisplayDialog( | ||||||||||||||||||||||||||||||||||||||||||||
| "Uninstall Banter SDK", | ||||||||||||||||||||||||||||||||||||||||||||
| "Are you sure? This will restart the unity editor.", | ||||||||||||||||||||||||||||||||||||||||||||
| "Affirmative", | ||||||||||||||||||||||||||||||||||||||||||||
| "Negative"); | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| if (!userResponse) return; | ||||||||||||||||||||||||||||||||||||||||||||
| RemoveRequest request = Client.Remove("com.sidequest.banter"); | ||||||||||||||||||||||||||||||||||||||||||||
| while(!request.IsCompleted) | ||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+45
to
+49
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: cat -n Editor/Resources/Builder/MenuUtils.cs | sed -n '40,60p'Repository: SideQuestVR/BanterSDK Length of output: 1033 🏁 Script executed: # Search for RemoveRequest usage in the codebase to understand the pattern
rg "RemoveRequest" -A 5 -B 2Repository: SideQuestVR/BanterSDK Length of output: 1260 🌐 Web query:
💡 Result:
Typical Editor pattern (poll each editor tick): [3] using UnityEditor;
using UnityEditor.PackageManager;
using UnityEditor.PackageManager.Requests;
static RemoveRequest _req;
static void RemovePkg(string name)
{
_req = Client.Remove(name);
EditorApplication.update += Tick;
}
static void Tick()
{
if (!_req.IsCompleted) return;
EditorApplication.update -= Tick;
if (_req.Status == StatusCode.Success) UnityEngine.Debug.Log("Removed");
else UnityEngine.Debug.LogError(_req.Error.message);
}If you also need to know when the Editor has applied/compiled/imported the resulting package set (not just when the request completed), subscribe to Sources: [1] Replace the busy-wait loop with
Safer pattern RemoveRequest request = Client.Remove("com.sidequest.banter");
- while(!request.IsCompleted)
- {
-
- }
+ EditorApplication.update += WaitForRemove;
+ void WaitForRemove()
+ {
+ if (!request.IsCompleted) return;
+ EditorApplication.update -= WaitForRemove;
+ if (request.Status == StatusCode.Success)
+ {
+ // continue cleanup here
+ }
+ else
+ {
+ Debug.LogError($"Remove failed: {request.Error.message}");
+ }
+ }
+ return;📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||
| if(Directory.Exists("Packages/com.basis.bundlemanagement")) | ||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||
| Directory.Delete("Packages/com.basis.bundlemanagement", true); | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
| if(Directory.Exists("Packages/com.basis.sdk")) | ||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||
| Directory.Delete("Packages/com.basis.sdk", true); | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
| if(Directory.Exists("Packages/com.basis.odinserializer")) | ||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||
| Directory.Delete("Packages/com.basis.odinserializer", true); | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
| if (Directory.Exists("Packages/com.sidequest.ora")) | ||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||
| Directory.Delete("Packages/com.sidequest.ora", true); | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
| EditUtils.RemoveCompileDefine("BANTER_ORA", new BuildTargetGroup[] { BuildTargetGroup.Android, BuildTargetGroup.Standalone }); | ||||||||||||||||||||||||||||||||||||||||||||
| EditUtils.RemoveCompileDefine("BASIS_BUNDLE_MANAGEMENT", new BuildTargetGroup[] { BuildTargetGroup.Android, BuildTargetGroup.Standalone }); | ||||||||||||||||||||||||||||||||||||||||||||
| EditorApplication.OpenProject(Directory.GetCurrentDirectory()); | ||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+50
to
+68
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: find . -type f -name "MenuUtils.cs" | head -20Repository: SideQuestVR/BanterSDK Length of output: 104 🏁 Script executed: find . -type f -name "manifest.json" | head -10Repository: SideQuestVR/BanterSDK Length of output: 47 🏁 Script executed: rg -l "ImportOraPackage\|ImportBasisPackages" --type csRepository: SideQuestVR/BanterSDK Length of output: 47 🏁 Script executed: cat -n "./Editor/Resources/Builder/MenuUtils.cs" | head -100Repository: SideQuestVR/BanterSDK Length of output: 3531 🏁 Script executed: rg "manifest\.json|ImportOraPackage|ImportBasisPackages|InitialiseOnLoad" --type cs -iRepository: SideQuestVR/BanterSDK Length of output: 928 🏁 Script executed: git ls-files | grep -i manifestRepository: SideQuestVR/BanterSDK Length of output: 47 🏁 Script executed: cat -n "./Editor/SDKInitialiseOnLoad.cs"Repository: SideQuestVR/BanterSDK Length of output: 19671 Remove the manifest.json entries for the deleted packages.
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
| #endif | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unchecked
LoadImagereturn value.Texture2D.LoadImage()returns a boolean indicating success. If the downloaded bytes are not a valid image format, this will fail silently and the callback will receive an invalid texture.Suggested fix
📝 Committable suggestion
🤖 Prompt for AI Agents