Strip localization comment metadata

Hello, I’m wondering if anyone has taken advantage of Comment metadata on localized strings without embedding it in the final game. I think I’m seeing that it’s still embedded in my game, and we don’t use it for anything at runtime, so I’d like to remove it - probably during builds?

Thought I’d mention it here in case there’s a simple or recommended solution I’m not seeing.

You could try adding #if UNITY_EDITOR to the comment metadata class. You will need to move the package code from the package cache into the project packages folder.

Removed internal comment field/property of the comment metadata class using #if UNITY_EDITOR, seems to work. Removing the class entirely broke things.

1 Like

Is this still the only way to achieve this? The comments data can get quite big in projects with many languages and including it seems like a waste. I’ve also noticed antivirus tools can detect links in the translation comments that translators included there for references to words/memes etc. When your game contains links to random foreign sites it can seem a bit suspicious.

It’d be nice if there was a way to remove it in build without editing the code of the package yourself.

No not at the moment. We did used to have idef UNITY_EDITOR on the Comment class but it caused some errors so we had to remove it. I think having it on the field is likely the correct approach. Ill add a task for us to look into adding this support.
For now a workaround is to modify the package code as suggested earlier.

1 Like