Make adressables great again #1494#1500
Open
rohitkulkarni97 wants to merge 248 commits intoRE-SS3D:developfrom
Open
Make adressables great again #1494#1500rohitkulkarni97 wants to merge 248 commits intoRE-SS3D:developfrom
rohitkulkarni97 wants to merge 248 commits intoRE-SS3D:developfrom
Conversation
…eters in asset creation methods, and removing DatabaseAsset.cs usage.
….Get method instead of DatabaseAsset's Prefab property, Create, Get<T>() & CreateAs<T>(...) functions, and different implicit operators.
…Creator and DatabaseScriptWriter for consistency in asset management workflow.
…, and Item to use Assets.Get method for improved consistency and clarity
…to use Assets.Get method for improved consistency
…and other places to streamline asset retrieval
…agement consistency
…tepCraftable, and Item to simplify usage of Assets.Get method
…nce to streamline addressable asset handling and improve code clarity
…nstructionHologramManager to utilize WorldObjectAssetReference for improved asset retrieval
…bjectsSO prefabs to enhance asset management
…eferences throughout the codebase for consistency
…proved readability
…AssetReference, and implement IEqualityComparer for improved comparison
…lementation and simplifying equality and hash code methods
…eters in asset creation methods, and removing DatabaseAsset.cs usage.
….Get method instead of DatabaseAsset's Prefab property, Create, Get<T>() & CreateAs<T>(...) functions, and different implicit operators.
…Creator and DatabaseScriptWriter for consistency in asset management workflow.
…, and Item to use Assets.Get method for improved consistency and clarity
…to use Assets.Get method for improved consistency
…and other places to streamline asset retrieval
…agement consistency
…leObject Converts the IAssetDatabase interface into an abstract ScriptableObject base class so database instances can be assigned to serialized fields in the inspector. DatabaseID moves to the base, and AssetGuids is exposed as an abstract IReadOnlyCollection<string> property so backends can back it with their own storage (List, HashSet, Dictionary.Keys, etc.) without double-serializing the GUID set. - Rename IAssetDatabase.cs to AssetDatabase.cs (preserves the meta GUID). - AddressablesDatabase inherits from AssetDatabase and overrides AssetGuids and ResolveKey. - Move the code-gen helper (GenerateDatabaseCode, path constants) to an AssetDatabase.Editor.cs partial so every database type inherits it. - Alias UnityEditor.AssetDatabase as UnityAssetDatabase in files that now see the new class in scope, to resolve the name collision. - Widen AssetSubSystem._databasesById and GetDatabase to AssetDatabase, and materialize AssetGuids in CraftingSubSystem since IReadOnlyCollection has no indexer.
… backend factory Catalogs now own their databases (serialized List<AssetDatabase>) and produce their own backend via an abstract factory method, so AssetSubSystem no longer hardcodes which backend or catalog to instantiate. Adding a new backend means adding a catalog + backend pair, with no AssetSubSystem changes. - Rename IAssetCatalog.cs to AssetCatalog.cs (preserves the meta GUID). - AddressablesCatalog becomes a ScriptableObject with a [CreateAssetMenu], overriding BackendType and CreateBackend. Runtime Initialize/Reset are gone — the serialized _databases list and the base's Has/ResolveKey implementations take their place. - AssetDatabaseSettings gains List<AssetCatalog> IncludedCatalogs alongside the existing IncludedAssetDatabases (which still drives code-gen). - AssetSubSystem.InitializeInternalAsync discovers catalogs from settings, calls CreateBackend once per distinct BackendType, and registers each catalog's databases in a single pass.
Unity re-saved all eight databases after the AssetDatabase refactor: the removed DatabaseName field is dropped, and the AssetGuids public field is renamed to the private backing field _assetGuids. GUID lists are preserved.
…ings Wires the new catalog system at runtime: a single AddressablesCatalog asset groups the eight existing AddressablesDatabase assets and is registered in AssetDatabaseSettings.IncludedCatalogs, which AssetSubSystem now reads on init. Confirmed in Play mode with "7 asset databases initialized".
…esDatabase to use new menu hierarchy constants
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.
Summary
This PR replaces the legacy static
Assetslookup/database bootstrap with a scene-owned, async asset system built around GUIDs, catalogs, backend loaders, and disposable asset handles. The configured content path now routes the main SS3D asset databases through Addressables, while the provider/lifecycle layer keeps loaded assets resident only while handles or spawned instances still reference them.It also adds the FishNet-side support required for addressable network prefabs: deterministic GUID-based prefab IDs, runtime registration of loaded addressable prefabs, synchronized client preloading before spawn, and late-join gating so clients do not observe addressable objects before the required prefabs are loaded.
PR checklist
Testing
Automated coverage added/updated:
AssetHandle,AssetProvider,AssetLifecycleTracker,InstanceLifetimeTracker, andNetworkObjectsGenerator.FakeAssetBackendand test assembly access for exercising the internal asset loading flow.Manual validation still needed:
Networking checklist
Changes
Asset System
AssetSubSystemas the startup-owned composition root for asset catalogs, backend initialization, database lookup, load/unload event relays, and the network preload barrier.AssetRequest<T>andAssetHandle<T>as the new async loading API. Handles are ref-counted and disposable; helper guards can tie handle lifetime to Unity objects.AssetProvider,AssetLifecycleTracker, andInstanceLifetimeTrackerto dedupe concurrent loads, track handles and instantiated prefab copies, and unload assets when the last reference is released.IAssetBackend,AddressablesBackend,ResourcesBackend, andAssetBackendType.Assetslookup flow and the separateAssetsInitializationTrigger.Catalogs And Databases
AssetCatalog/AssetDatabaseassets.AddressablesCatalogcontaining the seven configured databases: CraftingRecipes, InteractionIcons, Items, Materials, ParticlesEffects, Sounds, and WorldSpaceUI.Assets/Content/Data/AssetSystem/Databases.ObjectAssetReferenceso references store the asset GUID only, rather than GUID plus database ID.Networked Addressables
NetworkBarrierandPreloadConditionto coordinate loading addressable prefabs across server and clients.NetworkSpawneroverloads for spawning byObjectAssetReference, GUID,GameObject,NetworkObject, orNetworkBehaviourwhile ensuring clients are ready before FishNet spawns.NetworkObjectsasset keyed by deterministic GUID order.NetworkObjectsGenerator, generator settings, andNetworkObjectTrackerso network prefabs can be discovered, assigned stable FishNet prefab IDs, and registered when loaded through Addressables.NetworkBarrierprefab, wired it into the boot scene throughAssetSubSystem, and configured the generated NetworkObjects asset path.Content Migration
Assets/Art/Generated/Icons.AssetDatabaseSettings,AddressablesCatalog,NetworkObjects.asset,PreloadCondition.asset, andNetworkObjectsGeneratorSettings.asset.GenericObjectSoeditor/preprocessor support and stopped generating runtime preview icons inTileResourceLoader; resources now use stored icons with a missing-icon fallback.Gameplay Migration
AssetRequest/AssetHandleand the async network spawning path.InstanceFinder.ServerManager.Spawn(...)call sites that depend on database assets toNetworkSpawner.SpawnAsync(...).Related Issues/PRs
Related: #1494