android / tuningfork

Android Performance Tuner is a library to help developers measure frame rendering time across different devices and game stages. This plugin will help developers integrate Android Performance Tuner into their game.
https://developer.android.com/games/sdk/performance-tuner/unity
Other
53 stars 30 forks source link

Bug in Addressable scenes support #29

Open bnezo opened 1 year ago

bnezo commented 1 year ago

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 <e88faa3aac574192a3ac9d4dae8147a1>:0)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <e88faa3aac574192a3ac9d4dae8147a1>:0)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <e88faa3aac574192a3ac9d4dae8147a1>:0)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Boolean canAffectFocus) (at <e88faa3aac574192a3ac9d4dae8147a1>:0)
UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUIRaw (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus, System.Boolean verifyBounds) (at <e88faa3aac574192a3ac9d4dae8147a1>:0)
UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUI (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus, System.Boolean verifyBounds) (at <e88faa3aac574192a3ac9d4dae8147a1>:0)
UnityEngine.UIElements.IMGUIContainer.HandleEvent (UnityEngine.UIElements.EventBase evt) (at <e88faa3aac574192a3ac9d4dae8147a1>:0)
UnityEngine.UIElements.CallbackEventHandler.HandleEventAtTargetPhase (UnityEngine.UIElements.EventBase evt) (at <e88faa3aac574192a3ac9d4dae8147a1>:0)
UnityEngine.UIElements.MouseCaptureDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <e88faa3aac574192a3ac9d4dae8147a1>:0)
UnityEngine.UIElements.EventDispatcher.ApplyDispatchingStrategies (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, System.Boolean imguiEventIsInitiallyUsed) (at <e88faa3aac574192a3ac9d4dae8147a1>:0)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <e88faa3aac574192a3ac9d4dae8147a1>:0)
UnityEngine.UIElements.EventDispatcher.ProcessEventQueue () (at <e88faa3aac574192a3ac9d4dae8147a1>:0)
UnityEngine.UIElements.EventDispatcher.OpenGate () (at <e88faa3aac574192a3ac9d4dae8147a1>:0)
UnityEngine.UIElements.EventDispatcherGate.Dispose () (at <e88faa3aac574192a3ac9d4dae8147a1>:0)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <e88faa3aac574192a3ac9d4dae8147a1>:0)
UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at <e88faa3aac574192a3ac9d4dae8147a1>:0)
UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at <e88faa3aac574192a3ac9d4dae8147a1>:0)
UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at <e88faa3aac574192a3ac9d4dae8147a1>:0)
UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) (at <e88faa3aac574192a3ac9d4dae8147a1>:0)
UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <e88faa3aac574192a3ac9d4dae8147a1>:0)
UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) (at <e88faa3aac574192a3ac9d4dae8147a1>:0)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at <1c34070ddd5b426b8f32df1db927aad1>:0)
Ditronian commented 1 year ago

We observed the same error with our addressable scenes in Unity 2022. It appears APT assumes you are using the 'Full Path' option in the Addressable Group settings' Internal Asset Naming Mode. We were using GUIDs.

xavierarpa commented 6 months ago

same, I solve it here check this => https://github.com/android/tuningfork/issues/44

timbo-tj commented 2 months ago

Any plans to fix this? GUID scene names just dont work!