Chykary / FizzySteamworks

A transport for Mirror using Steam / Steamworks.NET
283 stars 32 forks source link

Assets\Mirror\Runtime\Transport\FizzySteamworks\NextCommon.cs(36,38): error CS1501: No overload for method 'Release' takes 1 arguments #33

Closed n8zone closed 1 year ago

n8zone commented 2 years ago

This error shows up in my console after importing FizzySteamworks. it leads to this code `#if !DISABLESTEAMWORKS using Steamworks; using System; using System.Runtime.InteropServices; using UnityEngine;

namespace Mirror.FizzySteam { public abstract class NextCommon { protected const int MAX_MESSAGES = 256;

    protected EResult SendSocket(HSteamNetConnection conn, byte[] data, int channelId)
    {
        Array.Resize(ref data, data.Length + 1);
        data[data.Length - 1] = (byte)channelId;

        GCHandle pinnedArray = GCHandle.Alloc(data, GCHandleType.Pinned);
        IntPtr pData = pinnedArray.AddrOfPinnedObject();
        int sendFlag = channelId == Channels.Unreliable ? Constants.k_nSteamNetworkingSend_Unreliable : Constants.k_nSteamNetworkingSend_Reliable;
        EResult res = SteamNetworkingSockets.SendMessageToConnection(conn, pData, (uint)data.Length, sendFlag, out long _);
        if (res != EResult.k_EResultOK)
        {
            Debug.LogWarning($"Send issue: {res}");
        }

        pinnedArray.Free();
        return res;
    }

    protected (byte[], int) ProcessMessage(IntPtr ptrs)
    {
        SteamNetworkingMessage_t data = Marshal.PtrToStructure<SteamNetworkingMessage_t>(ptrs);
        byte[] managedArray = new byte[data.m_cbSize];
        Marshal.Copy(data.m_pData, managedArray, 0, data.m_cbSize);
        SteamNetworkingMessage_t.Release(ptrs);

        int channel = managedArray[managedArray.Length - 1];
        Array.Resize(ref managedArray, managedArray.Length - 1);
        return (managedArray, channel);
    }
}

}

endif // !DISABLESTEAMWORKS`

trying to just delete the "ptrs" from the argument causes a new error Assets\Mirror\Runtime\Transport\FizzySteamworks\NextCommon.cs(36,13): error CS0120: An object reference is required for the non-static field, method, or property 'SteamNetworkingMessage_t.Release()'

If I replace SteamNetworkingMessage_t.Release() with data.Release() no errors occur