Shader names include [ ] characters which are used in label groups for Addressables, so [ ] are considered invalid for addressable resources. Would be nice to rename shaders.

Avatar
  • updated

If the shader elements are marked as addressable, their default address is their file path / name which includes [ ] and therefore requires manual fixing to work within addressables. or if you run the Addressables Analyze tool and it marks the shaders for you as invalid.

In the end, this causes the addressable system to fail builds due to [ ] characters.

Reporting a bug? please specify Unity version:
2021.3.15f1
Reporting a bug? please specify Shapes version:
4.2.1
Reporting a bug? please specify Render Pipeline:
Built-in render pipeline
Avatar
andrew trese

Here is the specific error from the Addressables builder -- 

Address 'Assets/Asset Packs/Shapes/Shaders/Generated Materials/Disc Additive [INNER_RADIUS][SECTOR].mat' cannot contain '[ ]'.

UnityEditor.AddressableAssets.Settings.AddressableAssetSettings:BuildPlayerContent (UnityEditor.AddressableAssets.Build.AddressablesPlayerBuildResult&)

RPG.Assets.Scripts.Editor.AddressableBuilder:BuildAddressableContent () (at Assets/Scripts/Editor/AddressableBuilder.cs:201)

RPG.Assets.Scripts.Editor.AddressableBuilder/<>c:<PerformAddressablesBuildWin64>b__4_1 () (at Assets/Scripts/Editor/AddressableBuilder.cs:51)

RPG.Assets.Scripts.Editor.AddressableBuilder:BuildAddressablesWithLogging (string,System.Action,System.Action,System.Action) (at Assets/Scripts/Editor/AddressableBuilder.cs:139)

RPG.Assets.Scripts.Editor.AddressableBuilder:PerformAddressablesBuildWin64 () (at Assets/Scripts/Editor/AddressableBuilder.cs:30)

Avatar
rak

[Edit: This solution does not work, but I'm going to leave it here in case this helps anyone to look into this further. Check my reply to this post for more details]

Hey Andrew, I ran into this annoying problem myself. But I found a solution and here is what I did to fix it if you have not figured it out yet:

1. First, go to the folder "Shapes/Shaders/Generated Materials" and delete all the generated materials.

2. Then open the GodengenShaders.cs file and edit line 123 as below:

string kws = $" ({string.Join( ")(", validKeywords )})";
if( kws.Contains( "()" ) ) // this means it has no permutations
kws = "";

Mainly, I replaced the square brackets with rounded brackets.

3. Finally, save, wait for recompilation, and then open Shpaes settings and "Regenerate Shaders and Materials"

That should fix it! I hope this gets fixed in the next update of Shapes :)

Avatar
rak
Quote from rak

[Edit: This solution does not work, but I'm going to leave it here in case this helps anyone to look into this further. Check my reply to this post for more details]

Hey Andrew, I ran into this annoying problem myself. But I found a solution and here is what I did to fix it if you have not figured it out yet:

1. First, go to the folder "Shapes/Shaders/Generated Materials" and delete all the generated materials.

2. Then open the GodengenShaders.cs file and edit line 123 as below:

string kws = $" ({string.Join( ")(", validKeywords )})";
if( kws.Contains( "()" ) ) // this means it has no permutations
kws = "";

Mainly, I replaced the square brackets with rounded brackets.

3. Finally, save, wait for recompilation, and then open Shpaes settings and "Regenerate Shaders and Materials"

That should fix it! I hope this gets fixed in the next update of Shapes :)

Ya just realized that solves only the addressable error but completely breaks the drawing scripts. There must be other scripts that are still looking for those square brackets. Need to find them and change them to round brackets. For now, I'm just gonna stick to regular lines with no end caps, they seem to be working for me even after the edit above. I will look further into this later or hopefully, this should be fixed by then.