Steamworks.NET icon indicating copy to clipboard operation
Steamworks.NET copied to clipboard

New callback dispatcher for .NET Standard 2.1

Open Akarinnnnn opened this issue 3 years ago • 4 comments

Breaking changes included

  1. Enabled unsafe code to use Pointers for heap Allocation Free
  2. Changed event handler delegate's signature, use ref T instead of T to avoid copy the event param.
  3. Throw System.ArgumentException instead of System.Exception when user passed an invalid handler while creating Callresult<T> and Callback<T>

Akarinnnnn avatar Dec 23 '20 09:12 Akarinnnnn

Examples for new handler

// For Callresult<T>
void OnCallresult(ref TypeName param, bool iofail)
{
    // do your operations
}

// For Callback<T>
void OnCallback(ref TypeName param)
{
    // do your operations
}

Akarinnnnn avatar Dec 23 '20 09:12 Akarinnnnn

I don't think we can do 1. as enabling unsafe on Unity is a pain. 2. & 3. seem good but we should probably wait until other breaking changes around here maybe: https://github.com/rlabrecque/Steamworks.NET/issues/389

rlabrecque avatar Dec 23 '20 18:12 rlabrecque

I don't think we can do 1. as enabling unsafe on Unity is a pain. 2. & 3. seem good but we should probably wait until other breaking changes around here maybe: #389

I will add some #ifdef later to enable these pointer tricks just on .NET Core platforms. And we can wait for #389 for enough time to evaluate how this breaking changes impacts.

Akarinnnnn avatar Dec 23 '20 23:12 Akarinnnnn

The new dispatcher was moved to a new file now.

Akarinnnnn avatar Jan 05 '21 01:01 Akarinnnnn