Skip to content

(WIP) Make adressables great again #1494#1500

Open
rohitkulkarni97 wants to merge 204 commits intoRE-SS3D:developfrom
rohitkulkarni97:Issues/Make-Adressables-great-again-#1494
Open

(WIP) Make adressables great again #1494#1500
rohitkulkarni97 wants to merge 204 commits intoRE-SS3D:developfrom
rohitkulkarni97:Issues/Make-Adressables-great-again-#1494

Conversation

@rohitkulkarni97
Copy link
Copy Markdown
Contributor

Summary

PR checklist

  • The game builds properly without errors.
  • No unrelated changes are present.
  • No "trash" files are committed.
  • Relevant code is documented.
  • Update the related GitBook document, or create a new one if needed.

Pictures/Videos

Testing

Networking checklist

  • Works from host in host mode.
  • Works from server in server mode.
  • Works on server in client mode.
  • Works and is syncronized across different clients.
  • Is persistent.

Changes

Related issues/PRs

…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
…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
…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
The custom event accessors forwarded directly to ActiveProvider, which
is null until async initialization completes. ScriptableObjects like
NetworkObjects subscribe in OnEnable before that, so their handlers
were silently discarded. Replace pass-through accessors with plain
static events and relay from the provider once it is created.
NetworkBarrier.Instance used a fragile self-managing singleton pattern.
The barrier is now owned by AssetSubSystem, which instantiates and
spawns it after both the asset system and FishNet server are ready.
This fixes the barrier's GameObject remaining inactive because it was
being spawned before FishNet's server had started.
Serialized prefabs that are directly embedded (non-addressable) were
not being initialized at runtime. Add an Initialize pass in OnEnable
that calls InitializePrefab for any already-loaded slots.
Prevents addressable NetworkObjects from being spawned on a client
until its late-join preload session has completed, ensuring prefabs
are registered in NetworkObjects before FishNet attempts instantiation.
The generator now sets every prefab's NetworkObserver to UseManager
(except NetworkBarrier which keeps IgnoreManager) so the
PreloadCondition from ObserverManager is applied at spawn time.
PreloadSession now stores the NetworkConnection so
TryFinalizePreloadSession can call RebuildObservers when the
session succeeds, allowing gated addressable objects to spawn.
…ng serialization, call it from Awake or Start instead.
The check was dead code (typed AssetHandle guarantees a NetworkObject)
and contained a bug that would NullReferenceException on instance.Dispose.
Every class that held an AssetHandle had its own private ReleaseHandle
method doing the same dispose-and-null dance. Consolidate into a single
static AssetHandle.Release<T> and update all call sites.
…access

Equals, GetHashCode, and GenerateHash were accessing the backing field
directly, which could return 0 on clients where the hash hasn't been
generated yet. Route all access through the Hash property.
The sync Load() call blocked the main thread while Addressables
needed it to complete, causing a deadlock. Extract the RPC body
into an async void helper that properly awaits LoadAsync().
Use AssetSubSystem.Has() for synchronous validation, then delegate
to an async void helper that properly awaits both LoadAsync() and
SpawnAsync(), eliminating two GetAwaiter().GetResult() deadlocks.
All callers have been converted to use LoadAsync(). The sync
wrapper using GetAwaiter().GetResult() deadlocked on Unity's
main thread when Addressables needed it to complete the load.
Rename LocalPlayerSpawnItemInFirstHandAvailable to async variant
and update PlaymodeTestRepository to yield the Task properly,
removing the last usage of the sync Load() path.
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.

1 participant