Skip to content

Unify Handlers via Adapter Interfaces (Future-Proof) #2

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: develop-2.0.0
Choose a base branch
from

Conversation

Extrys
Copy link
Owner

@Extrys Extrys commented May 16, 2025

Please drop all related feedback into the source PR for having everything in the same place

Key improvements in this extended branch of PR Unity-Technologies#3430

  • New interfaces
    • public INetworkPrefabInstanceHandlerSource: Common abstraction for all handler types, exposing a consistent adapter regardless of instantiation data
    • internal INetworkPrefabInstanceHandlerAdapter: Centralizes the instantiation flow under a single contract, removing the need for branching based on handler type

While INetworkPrefabInstanceHandlerAdapter remains internal, its design allows safe exposure for custom user-defined adapters if needed

  • Adapter-based routing

    • All handler types (INetworkPrefabInstanceHandler, INetworkPrefabInstanceHandlerWithData<T>, future variants...) now expose an adapter via INetworkPrefabInstanceHandlerSource
    • Eliminates type checks and separate dictionaries by handler type
    • Unifies all instantiation logic: for example, AddHandler now operate via the unified interfaces
    • The adapter determines whether custom data is needed, removing branching and parallel data paths
    • The system operates entirely through the adapter interface, reducing complexity and maintenance overhead
  • Compatibility adapters
    LegacyHandlerAdapter and PrefabInstanceHandlerWithDataAdapter wrap existing implementations without changing their internal behavior, for backwards compatibility

@Extrys Extrys changed the title Radical unification of PrefabInstanceHandler, Future proof for easy e… Unify Handlers via Adapter Interfaces (Future-Proof) May 16, 2025
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