This is a really quick thread to summarize my thoughts after looking through the changelogs and C# reference source changes related to the newly-released 2022.2 alpha.
CancellationToken properties
This is a really nice change, I’ve wanted something like Application.CancellationToken for quite some time now. I am however concerned about the choice to expose a cancellation token on every single MonoBehaviour. It appears to be lazily-allocated, but that’s still a pointer of memory overhead for every single MonoBehaviour instance. Maybe instead it might be better to track these outside of the MonoBehaviour instance and offer a GetOrCreateCancellationToken-like API?
Access to Mesh.bindposes as NativeArray
This is also really nice, and will allow me to reduce some allocations. However, Mesh.bindposeCount doesn’t appear to be settable, meaning I still need to allocate a dummy managed array to resize the buffer.
I’d also like to bring up my earlier 2022.1 threading wishlist post, as there still doesn’t appear to be a proper API to retrieve the main thread’s SynchronizationContext. I’ve updated that thread to contain a more appropriate API proposal, as the Object.IsAlive method previously suggested there was shown to not be necessary.