This is the documentation of the "Gamedistribution.com Unity HTML5 SDK plugin" project for adding the SDK within your Unity WebGL game.
Gamedistribution.com is the biggest broker of high quality, cross-platform games. We connect the best game developers to the biggest publishers.
Running into any issues?
Check out the F.A.Q. within the Wiki of the github repository before mailing to support@gamedistribution.com.
-
Download and import the .unitypackage into your game (download here).
-
Copy your GAME_KEY in your GameDistribution developer's control panel (in the 'Upload' tab), at developer.gamedistribution.com
-
Open the prefab and replace the GAME_KEY value with your own key.
-
Use GameDistribution.Instance.ShowAd() to show an advertisement.
-
Use GameDistribution.Instance.ShowRewardedAd() to show a rewarded advertisement.
-
Use GameDistribution.Instance.PreloadRewardedAd() to preload a rewarded advertisement
-
Make use of the events
GameDistribution.OnResumeGame
andGameDistribution.OnPauseGame
for resuming/pausing your game in between ads. -
Make use of the event GameDistribution.OnPreloadRewardedVideo for checking the availability of rewarded advertisement after called GameDistribution.Instance.PreloadRewardedAd()
public class ExampleClass: MonoBehaviour {
void Awake()
{
GameDistribution.OnResumeGame += OnResumeGame;
GameDistribution.OnPauseGame += OnPauseGame;
GameDistribution.OnPreloadRewardedVideo += OnPreloadRewardedVideo;
GameDistribution.OnRewardedVideoSuccess += OnRewardedVideoSuccess;
GameDistribution.OnRewardedVideoFailure += OnRewardedVideoFailure;
GameDistribution.OnRewardGame += OnRewardGame;
}
public void OnResumeGame()
{
// RESUME MY GAME
}
public void OnPauseGame()
{
// PAUSE MY GAME
}
public void OnRewardGame()
{
// REWARD PLAYER HERE
}
public void OnRewardedVideoSuccess()
{
// Rewarded video succeeded/completed.;
}
public void OnRewardedVideoFailure()
{
// Rewarded video failed.;
}
public void OnPreloadRewardedVideo(int loaded)
{
// Feedback about preloading ad after called GameDistribution.Instance.PreloadRewardedAd
// 0: SDK couldn't preload ad
// 1: SDK preloaded ad
}
public void ShowAd()
{
GameDistribution.Instance.ShowAd();
}
public void ShowRewardedAd()
{
GameDistribution.Instance.ShowRewardedAd();
}
public void PreloadRewardedAd()
{
GameDistribution.Instance.PreloadRewardedAd();
}
}
You can use multiple ad slots for rewarded ads and give your players multiple way of gathering rewards. Samples below is very nice way of implementing this feature.
Let them watch an ad to increase their attacks!
No coin no pain? Oh, it is not. Let them gain some free coins.
Who doesn't want a second chance?