# Fishnet

Explore how to host Unity projects on Edgegap using techniques from the FishNet HashGrid Sample.

{% embed url="<https://youtu.be/9Tnlgklg_qY>" %}

## ✔️ Preparation

Before we start, you will need:

* Unity 6 - [download using Unity Hub](https://unity.com/releases/unity-6),
* FishNet Unity package - [download from Unity Asset Store](https://assetstore.unity.com/packages/tools/network/fishnet-networking-evolved-207815),
  * this package includes the HashGrid sample.

Create a new project and import the FishNet package above.

## ⚡ Deploy and Connect

### 1. Deploy a Server on Edgegap

☑️ To get started, you'll need to [create a free account with Edgegap](https://app.edgegap.com/auth/register). No credit card required.

☑️ [Create a new app version for your application](https://app.edgegap.com/application-management/applications/fishnet-hashgrid-sample/versions/create), choose FishNet HashGrid Sample.

☑️ [Deploy a server with your FishNet HashGrid Sample app version](https://app.edgegap.com/deployment-management/deployments/list).

☑️ [Open your new deployment's details](https://app.edgegap.com/deployment-management/deployments/list).

☑️ Find your deployment's unique, one-time connection details:

* **Host URL** in format `780aa4260e83.pr.edgegap.net` ,
* **External Port** in format `30854`  (5 digits).

✅ You may now proceed to the next step.

### 2. Connect from Editor

☑️ Open your new project in Unity.

☑️ Open scene in folder FishNet / Demos / HashGrid / Scenes / HashGrid\_Demo.unity.

☑️ Select NetworkManager object in the scene, and modify Tugboat component in Inspector:

* set Client / Client Address to **Host URL** from previous step,
* set Server / Port to **External Port** from previous step.

☑️ Expand NetworkManager child game objects and select NetworkHudCanvas, then set `Auto Start Type`  to `Disabled`  to prevent your editor from starting in client-host mode.

☑️ Press the ▶️ Play button to start your game client.

☑️ Press Client button to connect to your server.

☑️ Connect a second virtual Player with [Multiplayer Play Mode](https://docs-multiplayer.unity3d.com/mppm/current/about/) or [ParrelSync](https://github.com/VeriorPies/ParrelSync).

🙌 Congratulations on your first Deployment on Edgegap!

## ✏️ Customize Server Build

To ensure your server build starts properly:

* edit your build profile (**Edit Build Settings** in Edgegap plugin) and add your scene,
* set `Auto Start Type`  to `Server`  in `NetworkHudCanvases`  component (child of `NetworkManager`),
* enable `Reuse Server Address` in your `Tugboat`  component to prevent error `AddressAlreadyInUse`.

{% hint style="success" %}
See [unity](https://docs.edgegap.com/unity "mention") for Unity to **learn how to build and customize servers**.
{% endhint %}
