feat: add option to remove from preloadedAssets when build player#267
Open
Magicqy wants to merge 1 commit intomob-sakai:mainfrom
Open
feat: add option to remove from preloadedAssets when build player#267Magicqy wants to merge 1 commit intomob-sakai:mainfrom
Magicqy wants to merge 1 commit intomob-sakai:mainfrom
Conversation
a9601b4 to
221db98
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add
Exclude From Preloaded Assets When Build Playeroption to support AssetBundle / Addressables hot-update workflows.When enabled, the settings asset is temporarily removed from
PlayerSettings.preloadedAssetsduring Player Build only, so it is NOT included in the built player. The asset remains in PreloadedAssets during normal Editor operation — all original auto-create, auto-register, and singleton behaviors are completely unchanged.At runtime, shaders loaded from AssetBundles cannot be found via
Shader.Find(). To address this, shader references are extracted from theShaderVariantCollectionat edit-time and serialized into a flatList<Shader>. At runtime,FindShaderByName()resolves shaders from this list first, falling back toShader.Find()only when no match is found. Additionally,Shader.Find()calls inTerminalMaskingShape.csandSoftMaskUtils.csare replaced withFindShaderByName()for consistency.How it works
s_BuildingPlayer = true, removes excluded settings from PreloadedAssets, logs the action.Initialize(). Thes_BuildingPlayerguard preventsSetDefaultSettings()from restoring PreloadedAssets.AssetPostprocessororinstancegetter that triggersSetDefaultSettings()is also guarded.s_BuildingPlayer = false, callsInitialize()to restore PreloadedAssets, logs the action.Changed files
PreloadedProjectSettings.cs— newm_ExcludeFromPreloadedAssetsWhenBuildPlayerfield,s_BuildingPlayerstatic flag,ExcludeFromBuildinner class (IPreprocessBuildWithReport+IPostprocessBuildWithReport), guard inInitialize()andinstancegetterShaderVariantRegistry.cs—m_RegisteredShadersfield,InitializeShaderLookup(),FindShaderByName(),SyncRegisteredShaders()UISoftMaskProjectSettings.cs— callInitializeShaderLookup()inOnEnableUISoftMaskProjectSettingsEditor.cs— expose the new option and registered shaders list in InspectorTerminalMaskingShape.cs/SoftMaskUtils.cs— useFindShaderByName()instead ofShader.Find()CHANGELOG.md/README.md— document the new featureType of change
Test environment
Checklist
developbranch