Skip to content

Create despawnCancellationToken for parity with destroyCancellationToken #2702

@Reag

Description

@Reag

Is your feature request related to a problem? Please describe.
I work with a lot of async Tasks and UniTasks in my project, and I like to include the destroyCancellationToken for when these async operations interact with MonoBehaviors. This is a really useful property they have! I would very much like to use the same sort of pattern for NetworkBehaviors.

Describe the solution you'd like
Id like a cancellation token, probably called despawnCancellationToken, that is created when an object is spawned and cancelled when a behavior is despawned. This would keep design parity with MonoBehaviours, and provide better management for the network lifecycle when using async programming.

Describe alternatives you've considered
Currently, I have a custom NetworkBehaviour I created for use with the OdinSerializer which implements this functionality. However, having it as a native part of the package seems more correct, as normal MonoBehaviours have this functionality.

Additional context
Honestly, this is a small feature request. I just figured it would be nice to be able to use the same type of patterns I currently work with on NetworkBehaviours.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:featureNew feature, request or improvement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions