Photon: Hashtable Errors with UnityScript

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:

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:

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:

var serverProperties : ExitGames.Client.Photon.Hashtable = new ExitGames.Client.Photon.Hashtable({"isPassworded" : (serverPassword != ""), "URL" : WorldDesc.url, "WorldName" : WorldDesc.name, "players" : playerList});

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!

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).

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. :slight_smile:

I’m sorry but it got late here already. I will send it asap next week. Thanks for your patience.

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

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

@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.

use this

ExitGames.Client.Photon.Hashtable gameProperties = new ExitGames.Client.Photon.Hashtable();

replace Hashtable () to ExitGames.Client.Photon.Hashtable