Here’s the sample c# code provided by Unity for the registration of a custom Analytics event:
using System.Collections.Generic;
using UnityEngine.Cloud.Analytics;
int totalPotions = 5;
int totalCoins = 100;
UnityAnalytics.CustomEvent("gameOver", new Dictionary<string, object>
{
{ "potions", totalPotions },
{ "coins", totalCoins }
});
I have attempted to convert this to JS, but met with limited success:
import System.Collections.Generic;
import UnityEngine.Cloud.Analytics;
UnityAnalytics.CustomEvent("gameOver", new System.Collections.Generic.Dictionary.<System.String, System.Object> ({
"name": screenName,
"coins", totalCoins
}));
Above code results in the following error:
Assets/Worlds/_Index/Scripts/IndexContentScreens.js(110,96): BCE0004: Ambiguous reference 'constructor': System.Collections.Generic.Dictionary.<String, Object>.constructor(System.Collections.Generic.IDictionary.<String, Object>), System.Collections.Generic.Dictionary.<String, Object>.constructor(System.Collections.Generic.IEqualityComparer.<String>).
Anyone care to point me in the right direction?