Search Unity

Third Party Photon: Hashtable Errors with UnityScript

Discussion in 'Multiplayer' started by EricL, Jan 8, 2014.

  1. EricL

    EricL

    Joined:
    Aug 1, 2012
    Posts:
    15
    Greetings!


    I'm using Photon Unity Networking (PUN) for my project. Because it was a while since I had last updated the library, I imported the newest version. I received these new errors after compilation:

    1. No appropriate version of 'PhotonNetwork.CreateRoom' for the argument list '(String, boolean, boolean, float, Boo.Lang.Hash, String[])' was found.

    2. The best overload for the method 'Room.SetCustomProperties(ExitGames.Client.Photon. Hashtable)' is not compatible with the argument list '(Boo.Lang.Hash)'.

    I understand that, for compatibility across operating systems, the standard hashtable can no longer be used. Now, scripts have to use Photon's hashtable. If I were using C#, all I would need to do to fix these errors is add this code at the top of my scripts that use hashtables:

    Code (csharp):
    1. using Hashtable = ExitGames.Client.Photon.Hashtable;
    I tried to find a solution to this with UnityScript by using the following import, but it did not work:

    Code (csharp):
    1. import ExitGames.Client.Photon.Hashtable;
    I then tried to define the hash tables locally instead. For example, I changed my PhotonNetwork.CreateRoom code to this:

    Code (csharp):
    1. var serverProperties : ExitGames.Client.Photon.Hashtable = new ExitGames.Client.Photon.Hashtable({"isPassworded" : (serverPassword != ""), "URL" : WorldDesc.url, "WorldName" : WorldDesc.name, "players" : playerList});
    2.  
    3. PhotonNetwork.CreateRoom(serverName, !serverHidden, true, serverOccupancy, serverProperties, serverInfo);
    This returned the following error:

    The type 'ExitGames.Client.Photon.Hashtable' does not have a visible constructor that matches the argument list '(Boo.Lang.Hash)'.

    How can I make Photon's hashtables work with UnityScript? Thank you for the help!
     
    Last edited: Jan 9, 2014
  2. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,072
    Hey Eric.
    Good point, actually. I totally missed to check what happens in UnityScript.
    Maybe someone here knows how to define the implementation to use in UnityScript??

    I think in the long run, we will have to get rid of the Hashtables alltogether and replace them with generic Dictionaries.
    We will also try to look for a workaround but it might take even a few weeks before I can update anything.
    In worst case, I could give you an older version without this change (and without Win 8 support).
     
  3. EricL

    EricL

    Joined:
    Aug 1, 2012
    Posts:
    15
    Thank you for the clarification, tobiass! Would you please send me that latest version of Photon without the hashtable change? I will use it so I can continue developing while a solution is being worked on. :)
     
  4. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,072
    I'm sorry but it got late here already. I will send it asap next week. Thanks for your patience.
     
  5. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,072
    I sent you a private message. Would be nice if you confirmed this working. If there is more need for this, I can then publish the download.
    Thanks, Tobias
     
  6. donw

    donw

    Joined:
    Sep 2, 2014
    Posts:
    1
    I have similar problems and would like to know if there is any update to this problem. Did the earlier vesion solve the problem? If so, can I also get the information on how to get the download?
    thanks,
    Don
     
  7. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,072
    @donw: Please download the new version from the Asset Store. I hope it fixes your problem. Else, let me know.
    Make sure you use the "using" line as described in the initial post.
     
  8. prabakar-sjn

    prabakar-sjn

    Joined:
    Aug 8, 2013
    Posts:
    2
    use this

    ExitGames.Client.Photon.Hashtable gameProperties = new ExitGames.Client.Photon.Hashtable();
     
  9. prabakar-sjn

    prabakar-sjn

    Joined:
    Aug 8, 2013
    Posts:
    2
    replace Hashtable () to ExitGames.Client.Photon.Hashtable