AttributeNetworkWrapperV2.Generator 1.1.0

dotnet add package AttributeNetworkWrapperV2.Generator --version 1.1.0
                    
NuGet\Install-Package AttributeNetworkWrapperV2.Generator -Version 1.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AttributeNetworkWrapperV2.Generator" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AttributeNetworkWrapperV2.Generator" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="AttributeNetworkWrapperV2.Generator" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add AttributeNetworkWrapperV2.Generator --version 1.1.0
                    
#r "nuget: AttributeNetworkWrapperV2.Generator, 1.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package AttributeNetworkWrapperV2.Generator@1.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=AttributeNetworkWrapperV2.Generator&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=AttributeNetworkWrapperV2.Generator&version=1.1.0
                    
Install as a Cake Tool

AttributeNetworkWrapperV2

Utility to mimic some Game Engine's functionality of marking functions as [RPC] that get auto serialized and sent

Use

This calls abstract functions that you must override to handle sending and recieving rpc's.

Classes that you must override are NetworkManager and Transport.

You call rpcs by using either Server/Client/Multi Rpc Attribute on methods, whose class has to have the 'partial' keyword:

[ServerRpc(Reliable)]
public static void Server_DoStuff(int param1, bool param2)
{

}

(Server_ prefix just used for readability)

on build, this generates:

public static void CallRpc_Server_DoStuff(int param1, bool param2)
{
      if (NetworkManager.Instance == null) return;

      using NetworkWriter writer = new NetworkWriter();
      writer.WritesShort(FunctionHash); //defined on build
      writer.WriteInt(param1);
      writer.WriteBool(Param2);
      NetworkManager.Instance.SendRpcToServer(writer);
}

Note, all rpc's MUST be 'public static void'

When this function gets called, it sends the rpc to the Server, where it then will be deserialized and called with the supplied args.

Any method using [ClientRpc] will have a ClientNetworkConnection parameter added at the start, this arg is the client this rpc will be sent to.

Example:

[ClientRpc]
public static void Client_DoStuff(int param1, bool param2)

// Generated
public static void CallRpc_Client_DoStuff(ClientNetworkConnection target, int param1, bool param2) 

And a function using [ServerRpc] can optionally have a ClientNetworkConnection parameter that will be suplied with the client who called this rpc.

Example:

[ServerRpc]
public static void Server_DoStuff(ClientNetworkConnection sender)
{
      CallRpc_Client_DoStuff(sender, 1, true);
}

Sending custom data

To send and receive your own data types, you can write Extension methods for NetworkWriter/NetworkReader, like:

public static void WriteVector2(this NetworkWriter writer, Vector2 vector)
{
    writer.write(vector.x);
    writer.write(vector.y);
}

public static Vector2 ReadVector2(this NetworkReader reader)
{
    return new Vector2(reader.ReadSingle(), reader.ReadSingle());
}

These extensions are detected while bulding and used where necessary, such as:

[MultiRpc(Unreliable)] //Gets invoked on every client, called by server.
public static void Multi_DoStuff(Vector2 vec) 

Starting Server

You first init your NetworkManager with your transport

CustomNetworkManager netManager = new();
netManager.Init(new CustomTransport()))   

Then you call StartServer(IsPeer) or ConnectToServer(Address), which should be handled by their respective Transport methods.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.0 105 6/4/2026
1.0.0 140 1/15/2026

Made deserialize methods internal instead of public
Swapped ArraySegment to ReadOnlySpan