-
Notifications
You must be signed in to change notification settings - Fork 446
feat: Allow to pass custom data on Spawn calls #3419
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
base: release/2.3.3
Are you sure you want to change the base?
Conversation
Thank you for your contribution! At this time, we would rather avoid adding parameters to the Could an approach like the |
thanks for the feedback! i will open an issue regarding my use case there is currently a forum post on unity i made for it, which is this I might copiy this into an issue to see if there is a pleasing solution here is the issue i created Also would it help if it were a new method instead of adding a parameter to the original method? Perhaps I could explore introducing a kind of spawn builder system where the Spawn() methods remain untouched, but external data can be attached through a chainable builder pattern. This would preserve the current API while allowing advanced usage patterns without impacting existing workflows or causing order issues Another idea I’d like to experiment with is decoupling the INetworkPrefabInstanceHandler from prefabs entirely, so it acts more like a general-purpose "Spawner" rather than being strictly tied to prefab references |
This PR introduces support for passing custom spawn data from the server to clients during the spawn process of a
NetworkObject
.This enables deterministic instantiation or contextual setup on the client without relying on RPCs or external sync steps.
Doesn't break or invalidate existing user code
the feature is fully optional and designed via an extension interface to preserve full backward compatibility.
Changelog
INetworkCustomSpawnDataReceiver
interface to allow reading custom spawn data on the client side.CreateObjectMessage
now includes optional CustomSpawnData handling.Testing and Documentation
Deprecated API
Backport
Implementation example