Overload methods of Hashtable using System and Photon namespaces

Project is in uJS and using Photon PUN.

So I’m trying to use a hashtable for setting some custom properties in the Photon player custom properties :

function ResetScores() 
{
	var props : Hashtable = new Hashtable();
	
	props.Add( "Kills", 0 );
	props.Add( "Deaths", 0 );
	props.Add( "Assists", 0 );
	
	PhotonNetwork.player.SetCustomProperties( props );
}

Now the only reference to uJS hashtables is here but there is no example of adding keys and values. I check a MSDN example and a few Photon questions and they are all in C#, but declared the same.

well that gave the error :

Assets/_Scripts/GameManager.js(386,57): BCE0017: The best overload for the method 'PhotonPlayer.SetCustomProperties(ExitGames.Client.Photon.Hashtable)' is not compatible with the argument list '(System.Collections.Hashtable)'.

I’m using generic List in the same script :

import System.Collections.Generic;
public class GameManager extends Photon.MonoBehaviour {

so thinking I had to use the photons system of collection, I tried using :

var props : ExitGames.Client.Photon.Hashtable = new Hashtable();

which gave the error :

Assets/_Scripts/GameManager.js(380,69): BCE0022: Cannot convert 'System.Collections.Hashtable' to 'ExitGames.Client.Photon.Hashtable'.

This is the first time I’ve used hashtable, all out of ideas and could really do with some advice and/or help. Maybe the problem is using System.Collections or Photon.MonoBehaviour ?

Thanks for reading.

Have you tried

var props : ExitGames.Client.Photon.Hashtable = new ExitGames.Client.Photon.Hashtable();

Looked like you were trying to fit a System Hashtable to the Photon Hashtable…

you could also try importing the photon namespace instead of the System one.

import ExitGames.Client.Photon;

So now

var props : Hashtable = new Hashtable();

should mean the Photon one, and not the System one.

Even though you’re not using C#, I assume there’s something similar to aliases in UnityScript. In C#, I would declare an alias by

using PhotonHashTable = ExitGames.Client.Photon.Hashtable;

right below all the other using directives. Now the compiler knows, at compile-time, to swap each instance of PhotonHashTable into that dot-monster.