Skip to content
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

Make "Automaticaly remove unused assets" less agressive. #8305

Closed
gnysek opened this issue Nov 5, 2024 · 6 comments
Closed

Make "Automaticaly remove unused assets" less agressive. #8305

gnysek opened this issue Nov 5, 2024 · 6 comments
Labels
feature request New feature (or a request for one)

Comments

@gnysek
Copy link
Contributor

gnysek commented Nov 5, 2024

Is your feature request related to a problem?

New option "Automaticaly remove unused assets is active by default for any projects created in 2024.4+ (including 2024.400 betas, so maybe even since February).

Issue is, that this setting ignores assets referenced by string (especially concatenated), and by tags. Many games might break, and people can be unaware, that their projects already have enabled such option for half year.
Assets referenced this way would be purged for 2024.4(00)+ projects if 2024.11 would be released without changes:

asset_get_index("asset_" + _variant);
tag_get_assets("my_selection")[0];

While (theoretically) assets mentioned using literal strings could be included when asset_get_index/tag_get_assets is in use (by stripping quotes around), there's still issue with using concatenated strings and variables.

Describe the solution you'd like

In my opinion:

  • by default, this setting should be set to undetermined state (null ?), which means it's disabled, same as when it's set to false - including new projects (but this could be still enabled/disabled from now on in Game Options > Main).
  • when importing FIRST package/prefab to project, it should ask to enable/disable automatic removal of assets, and remember that choice (since it won't be undetermined anymore, it would know, that there's no need to ask for it again; user could change this setting now if needs in Game Options > Main)
  • it should be renamed from option_remove_unused_assets to something else in options/main/options_main.yy, so 2024.4+ projects aren't affected and this setting won't be automatically enabled for projects made in last 6 months. My proposal is to name it option_purge_unused_assets, and remove previous config value on project load in 2024.11+, so none of existing projects would be affected.

This would make it optional, would cause less errors for newcomers, and people would be aware that they enabled it because of that pop-up (and maybe would read more about it in manual in that case, as while it's in release notes, when skipping 2024.11 and downloading 2025.x it won't be there anymore, and not everyone are reading all past release notes).

Describe alternatives you've considered

No response

Additional context

#8199
#8304
#8312

@Grisgram
Copy link

Grisgram commented Nov 5, 2024

I think, one possible way to handle this more transparent for the user, would be a new menu item in the "Build" menu, where all the "Clear...." items reside.

Something like "Dry run unused asset removal". This runs the build but instead of removing assets, it presents a list of assets that would be removed and you can pin assets as "keep" to prevent them from being removed (because you know, you reference them by string/concat/whatever.

gradle (google/android build system) also has options to prevent specific functions/classes/assets from being purged by setting.

@gnysek
Copy link
Contributor Author

gnysek commented Nov 5, 2024

Having an option to "preview" what would be stripped sounds good.
Having UI with checkboxes to prevent from removing even when not referenced would be even better.

@yerumaku
Copy link

yerumaku commented Nov 5, 2024

In the IDE on macOS, I could not find such a setting at all, is the path indicated in the documentation incorrect, or is the option on macOS called in some veiled way?

@yerumaku
Copy link

yerumaku commented Nov 5, 2024

  • I believe that some kind of special tag could be assigned to unused resources in automatic mode, which could also be automatically deleted when an asset is mentioned (or a flag in yy).
  • It would also be possible to "protect" the necessary assets from cleaning and deletion, for example, with a file format flag (.yy) or a special tag.

@gnysek
Copy link
Contributor Author

gnysek commented Nov 5, 2024

There's no deletion! Assets remain in project, this is only about executable.
And assets are protected to remain in exe by just mentioning them in code - even in part which would be removed by compiler optimizations, as assets are compiled by different system.

@rwkay
Copy link

rwkay commented Nov 6, 2024

Behaviour of Remove unused has been subtly changed see #8312

@rwkay rwkay closed this as completed Nov 6, 2024
@github-project-automation github-project-automation bot moved this from Triage to Done in Team Workload Nov 6, 2024
@gurpreetsinghmatharoo gurpreetsinghmatharoo added documentation Improvements or additions to documentation are required by this issue and removed documentation Improvements or additions to documentation are required by this issue labels Nov 7, 2024
@gurpreetsinghmatharoo gurpreetsinghmatharoo moved this from Done to Ready for QA in Team Workload Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature (or a request for one)
Projects
Status: Ready for QA
Development

No branches or pull requests

5 participants