Importing GONet

The good thing about having the do all the below is it is only once per project 😉

  1. Prerequisites
    1. Ensure you are using Unity3D 2018.3 or later
  2. Instructions (pre-import)
    1. Ensure unsafe code allowed: Edit => Project Settings => Player => Allow ‘unsafe’ Code
    2. Ensure .NET API version: Edit => Project Settings => Player => Api Compatibility Level* => .NET 4.x
    3. (optional) If you want GONet logging features, ensure logging configured: Edit => Project Settings => Player => Scripting Define Symbols (contains at least: “LOG_DEBUG;LOG_INFO;LOG_WARNING;LOG_ERROR;LOG_FATAL”)
    4. Import GONet unity package into your project
  3. Instructions (post-import)
    1. Compile (this should happen automatically after import), or the subsequent steps are not going to work
    2. IMPORTANT: Unzip the contents of Assets/GONet/ into the Assets folder (this creates the following highly important folders: Assets/StreamingAssets/GONet)
      1. Only ever do this ONCE per project into which you import GONet!
      2. The one time you do unzip, ensure to select to replace all files that may already be present (since the Compile step above will have created the Assets/StreamingAssets/GONet/DesignTimeLocations.txt file already, BUT we will overwrite that too during the unzip and that is OK this one time only!).
    3. Drag Assets/GONet/Resources/GONet/GONet_GlobalContext into your start-up scene (optionally => open Assets/GONet/Sample/GONetSampleScene.unity that already has it instead of using your scene)
    4. Ensure Script Execution Order is setup: Edit => Project Settings => Script Execution Order (Add GONet.GONetGlobal at a value of -32000 and GONet.GONetParticipant at a value of -199) <== setting included in package
    5. Click Run/Play in Unity editor to play the scene (code generation will occur and scene should play….no errors/exceptions…if all is well)
    6. With scene running and Game windows focused, press the following keys simultaneously on the keyboard to spawn a server: left ALT + S (GONetServer(Clone) instance appears in the scene and server is now listening for connections from clients)
    7. Click Run/Play in Unity editor to stop playing the currently playing scene
    8. If all that went well, you should be set to test some stuff in builds or just develop some and then test
  4. Instructions (with build)
    1. Create a build (e.g., gonet_sample.exe on Windows)
    2. If on Windows:
      1. Open project folder => /Assets/StreamingAssets/GONet and copy Start_CLIENT.bat and Start_SERVER.bat
      2. Paste files into build folder where gonet_sample.exe exists
      3. Open both pasted files, changing GONetSandbox.exe to gonet_sample.exe, save files
      4. Run Start_SERVER.bat (server needs to start first, running this bat file does that)
      5. Run Start_CLIENT.bat (client will connect to local server)
    3. If not on Windows:
      1. Run first instance of build, focus mouse there, press left ALT + S (server needs to start first…BEWARE: there is really no indication the server is started, but if the window had focus and you pressed the key combo it started)
      2. Run second instance of build, focus mouse there, press Left ALT + C (client will connect to local server…BEWARE: before pressing the key combo in the client window, the game might appear to be out of “data sync” and will correct itself once the client is connected to server….the client thinks he owns stuff that he does not until it is forced into submission!)
    4. Yay…you are off the ground with GONet! Go add some stuff to the scene with GONetParticipant component added to it and do something interesting with it, create another build, test again, rinse, repeat!

%d bloggers like this: