Closed fatihforgemaster closed 8 months ago
Hi,
The only other solution would be for you to store that someObject, so you won't need to pass it to the OnComplete callback and you can just pass the callback without a lambda and without allocations. Any other way I could implement would still create allocations because of boxing/unboxing (since I have no way to know what type your object is).
Hi,
The only other solution would be for you to store that someObject, so you won't need to pass it to the OnComplete callback and you can just pass the callback without a lambda and without allocations. Any other way I could implement would still create allocations because of boxing/unboxing (since I have no way to know what type your object is).
in my test () => OnCompleteEvent(GameObject) creates 128B alloc
you should add params object[] to callback boxing/unboxing 1 GameObject just creates 40B and we can use it for more use cases
void UnBoxing(params object[] box)
{
var b = box[0] as GameObject;
}
I pondered about it but there's also the issue that I cannot add a conditional callback
i just want to set data to OnComplete then i will use it inside complete method, i really just don't want to create lambda for it because of allocation. OnComplete(() => OnCompleteEvent(someObject))
just want to use it like OnComplete(OnCompleteEvent(someObject))