Skip to content

Symbols Approach for Addressables #1038

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: experimental/unity_6000
Choose a base branch
from

Conversation

Selva1910
Copy link

Modification on - Uncomment for Addressables as a Setting in Build Settings Editor Window

Description

Used Script Symbols, So that it can be toggle on and off with out much effort. It will get all the available targets present and add a symbol when you press apply.

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 🛠️ Bug fix (non-breaking change which fixes an issue)
  • ❌ Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 Code refactor
  • ✅ Build configuration change
  • 📝 Documentation
  • 🗑️ Chore

Modifed UnComment for Addressables code into a Settings in Build Settings Editor Window
@Selva1910
Copy link
Author

I hope this is kind of easy to preview or split the changes that i am making ?

@timbotimbo
Copy link
Collaborator

Thanks, this is much easier to understand,

You won't have to make a separate PR for each and every small feature, just make sure you can easily see what actually changed.

I did actually sync the Unity scripts in master with the 6000 branch after your PR. So a PR to master is fine too.
Sorry for not letting you know.

I tried this in my own project that already uses addressables, but where I've always manually built them so far.
With some small modifications I was able to export and the addressable assets were properly included in my build.

To get it to work I needed to:

Remove these comments:

#if USING_ADDRESSABLES
// uncomment for addressables
//using UnityEditor.AddressableAssets;
//using UnityEditor.AddressableAssets.Settings;
#endif

And I needed to add an Assembly Definition Reference to FlutterUnityInteration.Editor.asmdef.

"references": [
        "Unity.Addressables.Editor"
    ],

Having this reference (by name, not GUID) in a project without the Addressables package installed makes it show up greyed out. It doesn't cause any errors and installing the Addressables package enables it again.
So that should be safe to include by default.

asmdef

One small issue seems to be that the state of the checkbox isn't always correct.
Sometimes USING_ADDRESSABLES is enabled but the checkbox shows up as unchecked when opening the settings menu.
Simply restarting Unity can cause this. Removing the define symbol in the player settings makes this happen too.

Maybe this state can be directly loaded from the existence of USING_ADDRESSABLES?

@Selva1910
Copy link
Author

Selva1910 commented Aug 9, 2025

Cool I will note these things down. And I will update the full changes this was raised most probably just to verify everything is fine for reviewing.

- Prefs not Initializing so that the toggle state was not synced
- Uncommented Addressables Headers
- Added Name References for Addressables to Editor AsmDef
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants