ONI_Together_API 0.7.2-alpha.0.34

This is a prerelease version of ONI_Together_API.
dotnet add package ONI_Together_API --version 0.7.2-alpha.0.34
                    
NuGet\Install-Package ONI_Together_API -Version 0.7.2-alpha.0.34
                    
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="ONI_Together_API" Version="0.7.2-alpha.0.34" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ONI_Together_API" Version="0.7.2-alpha.0.34" />
                    
Directory.Packages.props
<PackageReference Include="ONI_Together_API" />
                    
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 ONI_Together_API --version 0.7.2-alpha.0.34
                    
#r "nuget: ONI_Together_API, 0.7.2-alpha.0.34"
                    
#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 ONI_Together_API@0.7.2-alpha.0.34
                    
#: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=ONI_Together_API&version=0.7.2-alpha.0.34&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=ONI_Together_API&version=0.7.2-alpha.0.34&prerelease
                    
Install as a Cake Tool

ONI Together API

API for third-party mods to add multiplayer features via Oxygen Not Included Together.

Installation

dotnet add package ONI_Together_API

Usage

Check if ONI Together is installed and enabled

using ONI_Together_API;

if (MP_Mod_Info.MultiplayerModPresent)
{
    // ONI Together is detected and enabled
}

Access session info

if (SessionInfoAPI.InSession)
{
    bool isHost = SessionInfoAPI.IsHost;
    bool isClient = SessionInfoAPI.IsClient;
    ulong localUserId = SessionInfoAPI.LocalUserID();
    ulong hostUserId = SessionInfoAPI.HostUserID();
}

Creating custom packets

using ONI_Together.Networking.Packets.Architecture;
using ONI_Together_API.Networking;

public class ExamplePacket : IPacket
{
    private ulong SenderId;
    private string Message;

    public ExamplePacket(ulong senderId, string message) 
    {
        SenderId = senderId;
        Message = message;
    }
    
    public void Serialize(BinaryWriter writer) 
    {
        writer.Write(SenderId);
        writer.Write(Message);
    }
    
    public void Deserialize(BinaryReader reader) 
    {
        SenderId = reader.ReadUInt64();
        Message = reader.ReadString();
    }
    
    public void OnDispatched() 
    {
        Console.WriteLine($"Received example packet from {SenderId}: {Message}");
        if (SessionInfoAPI.IsHost) return;
        
        Console.WriteLine($"Recieved this message from the host: {Message}");
    }
}

Sending custom packets

public void SendMyCoolPacket() 
{
    if (SessionInfoAPI.IsClient) return;
    
    // Only the host can send this
    ExamplePacket packet = new ExamplePacket(SessionInfoAPI.LocalUserID(), "Hello ONI Together");
    PacketSenderAPI.SendToAllClients(packet, PacketSendMode.Reliable);
}

Requirements

  • Oxygen Not Included (with ONI Together mod installed)
  • .NET Standard 2.1 compatible project

License

MIT

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.1

    • No dependencies.

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
0.7.2-alpha.0.34 96 6/13/2026