Bug in Addressable scenes support
- Dominant language
- C#
- Stars
- 62
- Forks
- 33
- PR merge metrics
- No merged PRs in 30d
Description
The addressable scenes do not have an extension in our project, so the scene detection fails on trying to run string replace where the source string ends up being an empty string.
The offending line is here:
https://github.com/android/tuningfork/blob/fa93d9d4e707d020836952c8064ab4d2bf6f38e2/Runtime/Scripts/AddressablesScenesEnumInfo.cs#L53
One workaround is of course to simply check if there is an extension before trying to remove it. It seems to work if I modify the code to do just that.
This is the full error:
```
ArgumentException: oldValue is the empty string.
System.String.ReplaceInternal (System.String oldValue, System.String newValue) (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.String.Replace (System.String oldValue, System.String newValue) (at <695d1cc93cca45069c528c15c9fdd749>:0)
Google.Android.PerformanceTuner.AddressablesScenesEnumInfo.ConvertScenePathToProtoEnumEntry (System.String scenePath, System.Boolean isAddressableScene) (at Library/PackageCache/com.google.android.performancetuner@fa93d9d4e7/Runtime/Scripts/AddressablesScenesEnumInfo.cs:50)
Google.Android.PerformanceTuner.AddressablesScenesEnumInfo..ctor (System.String scenePath, System.Int32 value) (at Library/PackageCache/com.google.android.performancetuner@fa93d9d4e7/Runtime/Scripts/AddressablesScenesEnumInfo.cs:43)
Google.Android.PerformanceTuner.SetupConfig.UpdateAddressablesScenes () (at Library/PackageCache/com.google.android.performancetuner@fa93d9d4e7/Runtime/Scripts/SetupConfig.cs:121)
Google.Android.PerformanceTuner.Editor.AddressablesSettingsEditor.OnGUI () (at Library/PackageCache/com.google.android.performancetuner@fa93d9d4e7/Editor/Scripts/AddressablesSettingsEditor.cs:58)
Google.Android.PerformanceTuner.Editor.AndroidPerformanceTunerWindow.OnGUI () (at Library/PackageCache/com.google.android.performancetuner@fa93d9d4e7/Editor/Scripts/AndroidPerformanceTunerWindow.cs:176)
UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition, UnityEngine.Rect viewRect) (at <55729f52d042492e9efc384182ae2feb>:0)
UnityEditor.DockArea.DrawView (UnityEngine.Rect viewRect, UnityEngine.Rect dockAreaRect) (at <55729f52d042492e9efc384182ae2feb>:0)
UnityEditor.DockArea.OldOnGUI () (at <55729f52d042492e9efc384182ae2feb>:0)
UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize, System.Action onGUIHandler, System.Boolean canAffectFocus) (at :0)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Action onGUIHandler, System.Boolean canAffectFocus) (at :0)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Action onGUIHandler, System.Boolean canAffectFocus) (at :0)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Boolean canAffectFocus) (at :0)
UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUIRaw (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus, System.Boolean verifyBounds) (at :0)
UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUI (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus, System.Boolean verifyBounds) (at :0)
UnityEngine.UIElements.IMGUIContainer.HandleEvent (UnityEngine.UIElements.EventBase evt) (at :0)
UnityEngine.UIElements.CallbackEventHandler.HandleEventAtTargetPhase (UnityEngine.UIElements.EventBase evt) (at :0)
UnityEngine.UIElements.MouseCaptureDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at :0)
UnityEngine.UIElements.EventDispatcher.ApplyDispatchingStrategies (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, System.Boolean imguiEventIsInitiallyUsed) (at :0)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at :0)
UnityEngine.UIElements.EventDispatcher.ProcessEventQueue () (at :0)
UnityEngine.UIElements.EventDispatcher.OpenGate () (at :0)
UnityEngine.UIElements.EventDispatcherGate.Dispose () (at :0)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at :0)
UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at :0)
UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at :0)
UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at :0)
UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) (at :0)
UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at :0)
UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) (at :0)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at <1c34070ddd5b426b8f32df1db927aad1>:0)
```
Contributor guide
Research direction
Start in Runtime/Scripts/AddressablesScenesEnumInfo.cs at ConvertScenePathToProtoEnumEntry, especially the line linked in the issue, and trace its caller from SetupConfig.UpdateAddressablesScenes. Reproduce the editor error with an addressable scene that has no extension, then verify scene detection completes without the empty-string exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, unity
- Domain
- game-dev, tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100