android / android/tuningfork

Bug Using custom Addressable Name in "Google.Android.PerformanceTuner.AddressablesScenesEnumInfo.ConvertScenePathToProtoEnumEntry()"

Open
#44 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
62
Forks
33
PR merge metrics
No merged PRs in 30d

Description

Hey

I find having a scene called "System_Audio" fail when I'm trying to update the Addressables Settings scenes in ATP tab

here some images:
![Captura de pantalla 2024-03-01 a las 14 53 08](https://github.com/android/tuningfork/assets/44328679/8dca82ad-1489-4efa-89e5-6ebd7d7e04d1)
![Captura de pantalla 2024-03-01 a las 14 53 40](https://github.com/android/tuningfork/assets/44328679/2e822838-370a-434d-a65f-ded4b2e86a70)

Issue Happens because method assumes addresable item contains extension file in their name

instead of doing this
```cs
// Use this function to get the protobuf Scene Enum entry corresponding to a scene.
public static string ConvertScenePathToProtoEnumEntry(string scenePath, bool isAddressableScene)
{
string sceneName = scenePath
.Replace(Path.DirectorySeparatorChar, '_')
.Replace(Path.AltDirectorySeparatorChar, '_')
.Replace(Path.GetExtension(scenePath), "")
.Replace(" ", "_")
.ToUpper();
sceneName = k_SceneFieldRegex.Replace(sceneName, "");
string prefix = isAddressableScene ? "ADDR_" : "";
return prefix + sceneName;
}
```

do this

```cs
// Use this function to get the protobuf Scene Enum entry corresponding to a scene.
public static string ConvertScenePathToProtoEnumEntry(string scenePath, bool isAddressableScene)
{
string sceneName = scenePath
.Replace(Path.DirectorySeparatorChar, '_')
.Replace(Path.AltDirectorySeparatorChar, '_')
.Replace(" ", "_")
.ToUpper();

// parche, en caso de que el item posea extension se la quitamos
if(Path.GetExtension(scenePath)?.Length > 0)
{
sceneName = sceneName.Replace(Path.GetExtension(scenePath), "");
}
else
{
// Fino mi pana 👍
}

sceneName = k_SceneFieldRegex.Replace(sceneName, "");
string prefix = isAddressableScene ? "ADDR_" : "";
return prefix + sceneName;
}
```

in this case, if addressable item does not have an extension it does not give you a zero lenght string, causing a false positive error

hope it helps :) !😎

Contributor guide

Open the contributing guide

Research direction

Locate Google.Android.PerformanceTuner.AddressablesScenesEnumInfo.ConvertScenePathToProtoEnumEntry() and inspect how it handles addressable scene paths without file extensions. Reproduce the failure with an addressable item named System_Audio, then verify conversion succeeds without a false error while paths with extensions retain their existing behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, 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
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.