Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

DarkRift Server Plugins on Linux Machines: Errors and How to Fix it.

Discussion in 'Assets and Asset Store' started by Finnark, Dec 4, 2016.

  1. Finnark

    Finnark

    Joined:
    Feb 21, 2014
    Posts:
    8
    I ended up using 6 hours of my time trying to figure out this problem and ended up with a solution that requires a single line of code (oh those programmers moments.....) so in order to leave myself a note and to possibly salvage other people from wasting 6 hours of their time, I decided to share my experience on here.

    Note:
    This is for people trying to develop DarkRift plugins in Visual Studio 2015 on a Windows 10 OS and running the DarkRift Server and library in Raspberry pi under mono, though as long as youre using VS of some sort in Windows and running it in linux of some sort under mono, I believe the same thing applies.

    Lately, I have been using DarkRift as my method of network communication in unity. (Thanks to Jamster for the software and support. Its perfect!) and since DarkRift 1.3, the server application can apparently be run on Linux machines. Therefore, I decided to take a shot at it by taking out my Raspi 3 (running raspbian jesse) and use it as a server machine with MySQL database inside.

    For MySQL access, I decided to use the official DarkRift MySQL Connector. After installing mono on my raspi, I ran the server application by typing
    on the terminal. Immediately the following error occurred:

    Figure 1:

    In addition, theres a unusual directory for MySQLConnector created in the main directory as Figure 2 shows:

    Figure 2:


    Why? Well, apparently, DarkRift application itself works fine with mono, but the plugin support for it isnt exactly compatible with it. The highlighted code in figure 3 (the code is from MySQLConnector solution) is the part I think is causing the fishy behavior of the application.

    Figure 3:


    If you try to Debug.Log the highlighted function on their unity instance, you'll see that it will print out a directory separated with "\" key. This apparently does not work properly in mono as can be seen in their official documents (scroll down to "General Guidelines" section).

    How to fix this issue:
    Simply type the following code before starting DarkRift:
    What this does is it makes the application recognize "\" marks as a directory separator as well as prevent the system from becoming case-sensitive when reading files and folders. Figure 4 shows that by typing this command, DarkRift plugins will work properly.

    Figure 4:


    There is apparently a slight performance penalty when using this workaround but I guess its better than plugins not working at all. ;)

    In addition:
    MySQLConnector will show another IOException error when trying to access the database during runtime. This can be solved by adding MySql.Data.dll in the Plugins directory (the DLL is in the same directory where you get the MySQLConnector.dll after building your project)

    Hope this helps!
     
    Last edited: Dec 4, 2016
    Jamster likes this.
  2. sweenyblue

    sweenyblue

    Joined:
    Dec 11, 2016
    Posts:
    1
    I'm running my Dark Rift server on an Ubuntu cloud image with mono and this solution worked for me as well! Thanks for saving me the time!
     
    Finnark likes this.