#Custom Event Error in UGS Analytics

1 messages · Page 1 of 1 (latest)

dry elbow
#

Hey all. Just now setting up some analytics for my game and I wanted to make a custom event to track some balance related game data in my game.

I followed this documentation: https://docs.unity.com/ugs/manual/analytics/manual/custom-event
And this:
https://docs.unity.com/ugs/en-us/manual/analytics/manual/record-event

However, when I call RecordEvent I get the following error:
"'IAnalyticsService' does not contain a definition for 'CustomEvent' and no accessible extension method 'CustomEvent' accepting a first argument of type 'IAnalyticsService' could be found (are you missing a using directive or an assembly reference?)"

Any idea what I might be doing wrong? Thanks!

flat bluff
#

Post your code here. And what version of the Analytics Package are you using?

dry elbow
#

6.2

#

This is where I'm calling "RecordEvent"

    var analyticsEvent = new PlayerDataSubmittedEvent
    {
        matchId = GameManager.Instance.matchId.Value.ToString(),
        profilePicturePath = profilePicturePath.ToString(),
        cardBackPath = cardBackPath.ToString(),
        deckJson = deckJson.ToString(),
        skillTreeJson = skillTreeJson.ToString(),
        playerName = playerNameValue.ToString()
    };

    AnalyticsService.Instance.RecordEvent(analyticsEvent);
#

This is my custom event class:

public class PlayerDataSubmittedEvent : Unity.Services.Analytics.Event
{
public PlayerDataSubmittedEvent() : base("player_data_submitted") { }

public string matchId { get; set; }
public string profilePicturePath { get; set; }
public string cardBackPath { get; set; }
public string deckJson { get; set; }
public string skillTreeJson { get; set; }
public string playerName { get; set; }

}

#

Also, the class calling RecordEvent also has "using Unity.Services.Analytics;" as an import.

#

I also created the custom event in the UGS Dashboard and created custom parameters for each of these fields, setting them all as strings.

flat bluff
# dry elbow 6.2

Did you mean Analytics 6.1?
In your code, I'm not seeing any references to 'CustomEvent'. Can you see which line is thowing that error?

dry elbow
#

Yep, I'm an idiot. Unity 6.2, analytics 6.1.

The line "AnalyticsService.Instance.RecordEvent(analyticsEvent);" is throwing the error. And it's very strange looking in Visual studio, just the first letter of analyticsEvent in that line is red underlined.

flat bluff
#

I think you might be missing the SetParameter() in the PlayerDataSubmittedEvent
It is a weird error for that to give though