Skip to content

HighKeys/FishyUnityTransport

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

76 Commits
 
 
 
 
 
 
 
 

Repository files navigation

FishyUnityTransport

A UnityTransport implementation for Fish-Net.

If you have further questions, come find me as ooonush in the FirstGearGames Discord!

The FishyUnityTransport library API is close to UnityTransport for NGO and uses some of its code.

Dependencies

Make sure you have the following packages installed:

  1. UnityTransport 1.3.1 or newer
  2. Fish-Net

Setting Up

  1. Install Fish-Net from the official repo or Asset Store.

  2. Install UnityTransport package.

  3. Install FishyUnityTransport unitypackage from the release section or using the Git URL:

    https://github.com/ooonush/FishyUnityTransport.git?path=Assets/FishNet/Plugins/FishyUnityTransport
    
  4. Add the "FishyUnityTransport" component to your "NetworkManager".

Unity Relay support

This library supports Unity Relay, and since its API is similar to the UnityTransport for NGO API, I recommend reading the official Relay documentation.

I also recommend you read the Relay section in NGO docs.

Key differences. Simple host connection sample:

[SerializeField] private NetworkManager _networkManager;

public async Task StartHost()
{
    var utp = (FishyUnityTransport)_networkManager.TransportManager.Transport;

    // Setup HostAllocation
    Allocation hostAllocation = await RelayService.Instance.CreateAllocationAsync(4);
    utp.SetRelayServerData(new RelayServerData(hostAllocation, "dtls"));

    // Start Server Connection
    _networkManager.ServerManager.StartConnection();
    // Start Client Connection
    _networkManager.ClientManager.StartConnection();
}

public async Task StartClient(string joinCode)
{
    JoinAllocation joinAllocation = await RelayService.Instance.JoinAllocationAsync(joinCode);
    utp.SetRelayServerData(new RelayServerData(joinAllocation, "dtls"));

    // Start Client Connection
    _networkManager.ClientManager.StartConnection();
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 100.0%