Problem with hashtables

I’m using Photon and I need to make a hashtable for the customproperties for the room but get these errors.

Assets/Scripts/MultyPlayer/newMulty.cs(132,39): error CS1502: The best overloaded method match for `PhotonNetwork.CreateRoom(string, bool, bool, int, ExitGames.Client.Photon.Hashtable, string[])' has some invalid arguments

Assets/Scripts/MultyPlayer/newMulty.cs(132,39): error CS1503: Argument `#5' cannot convert `System.Collections.Hashtable' expression to type `ExitGames.Client.Photon.Hashtable'

2 Answers

2

Well, the error itself is self-explanatory: The CreateRoom method is expecting an ExitGames.Client.Photon.Hashtable but you are passing in a System.Collections.Hashtable. It could be that you’ve upgraded Photon without first deleting the previous version, so you might have old and new files of Photon mixed together. Try deleting the Photon folder and re-importing it and see if that doesn’t clear the error. Other than that you’d have to go into more detail and change the type of hashtable that you are passing in to the method.

Thanks I'll give it a try

Did that solve your issue?

I have this same problem but I'm using the same photon as I always have. Do I need to do an include? I'm already extending photon.monobehaviour

Declare the collection type when you declare the variable : var myHashtable : ExitGames.Client.Photon.Hashtable = new ExitGames.Client.Photon.Hashtable(); http://answers.unity3d.com/questions/562204/overload-methods-of-hashtable.html Edit : sorry, yeah my example is in uJS

If you're coding in C# you can alias the types like so: using PhotonHashtable = ExitGames.Client.Photon.Hashtable; using SystemHashtable = System.Collections.Hashtable; public class MyObject { public PhotonHashtable PhotonHashtableField; public SystemHashtable SystemHashtableField; }

using Hashtable = ExitGames.Client.Photon.Hashtable;

;D