Overview

The Madder Messager is a static class that provides functions to interface between the WebGL build and the Unity game.

Usage

VibratePlayerController

The VibratePlayerController function vibrates a player’s controller briefly. The gamername parameter is the gamername of the player controller you want to vibrate and is REQUIRED.

MadderMessager.VibratePlayerController(string gamername);

VibrateAllPlayerControllers

The VibrateAllPlayerControllers function vibrates all player controllers briefly.

MadderMessager.VibrateAllPlayerControllers();

UpdateMadderPlayerStats

The UpdateMadderPlayerStats function updates a player’s stats on the Madder server. You decide when this gets called; however, if your game crashes or the host exits the game without you making the call, the stats will not be updated.

The MadderPlayer parameter is a serialized JSON string of the MadderPlayer object and is REQUIRED.

The MadderPlayer object contains the player’s gamername and a dictionary of MadderStat objects.

MadderMessager.UpdateMadderPlayerStats(string madderPlayer);

ShowCode

The ShowCode function displays the room code on the game screen. This function may be called on Start() but must not be called on Awake(), or the room code will not display. This function should only be called when not in the Unity Editor.

#if !UNITY_EDITOR
    MadderMessager.ShowCode();
#endif

HideCode

The HideCode function hides the room code from the game screen. This function should only be called when not in the Unity Editor.

#if !UNITY_EDITOR
    MadderMessager.HideCode();
#endif