Game
Unity API
12 years ago

[Deprecated] Getting started with the Unity API Helper v1.2


Warning! This version of the API is deprecated. You should use version 2 instead!

Make sure to read the API tutorial first.

1 - Core Helper

Initialization

It looks like you’ve been used to the API already but no, you don’t need to initialize the helper. You can use it straight away. It will initialize itself when you first call it.

User Helpers

  • Retrieve user information from the Game Jolt website. It takes one parameter: a callback that accept 2 strings as parameters.

		
			// Helper call.
GJAPIHelper.Users.GetFromWeb (OnGetFromWeb);

// Callback
void OnGetFromWeb (string name, string token)
{
     Debug.Log (name + "@" + token); 
}
		
	
  • Show/Dismiss the login window.

		
			GJAPIHelper.Users.ShowLogin (); 
GJAPIHelper.Users.DismissLogin ();
		
	
  • Show the user some love. You need to have a verified user though.

		
			GJAPIHelper.Users.ShowGreetingNotification ();
		
	
  • Download a user avatar. If it fails, a default avatar will be supplied. It takes two parameters: the user and a callback that accept a Texture2D as parameter.

		
			// Helper call 
GJAPIHelper.Users.DownloadUserAvatar (user, OnCompleteCallback);

// Callback
void OnCompleteCallback (Texture2D avatar) {}
		
	

Score Helpers

  • Show/Dismiss the leaderboards.

		
			GJAPIHelper.Scores.ShowLeaderboards ();  
GJAPIHelper.Scores.DismissLeaderboards ();
		
	

Trophies Helpers

  • Set secret trophies. Pass the secret trophies IDs and a boolean (true if you want the trophies to show with ??? as description or false if you don’t want them to show unless they are already unlocked.

		
			uint[] secret_trophies = {1432,2345};
GJAPIHelper.Trophies.SetSecretTrophies (secret_trophies, true);
		
	
  • Show/Dismiss the trophies list.

		
			GJAPIHelper.Trophies.ShowTrophies (); 
GJAPIHelper.Trophies.DismissTrophies ();
		
	
  • Show a trophy unlock notification. It takes one parameter: the trophy ID.

		
			GJAPIHelper.Trophies.ShowTrophyUnlockNotification (1337);
		
	
  • Download a trophy icon. If it fails, a default icon will be supplied. It takes two parameters: the trophy and a callback that accept a Texture2D as parameter.

		
			// Helper call
GJAPIHelper.Trophies.DownloadTrophyIcon (trophy, OnCompleteCallback);

// Callback
void OnCompleteCallback (Texture2D icon) {}
		
	

2 - Modify/Extend it!

GUI Skin

  • Change the GUI Skin.

		
			GJAPIHelper.Skin = MySkin;    
		
	
  • Use the Helper GUI Skin for your own GUI.

		
			void OnGUI ()  
{  
    GUI.skin = GJAPIHepler.Skin;  
}
		
	

Custom Notifications

  • Create it.

		
			// Small notification with text only.
// This is used by Users.ShowGreetingNotification.
GJHNotification textOnlyNotification =
   new GJHNotification ("Title");

// Bigger notification with an icon.
// This is used by Trophies.ShowTrophyUnlockNotification.
GJHNotification withIconNotification =
    new GJHNotification ("Title", "Description", icon);
		
	
  • Customize it a bit.

		
			myNotification.Anchor = GJHNotificationAnchor.TopLeft;
myNotification.DisplayTime = 3f;
		
	
  • Add it to the queue. It will wait until there is no other notification showing if there is any.

		
			GJHNotificationsManager.QueueNotification (notification1);  
GJHNotificationsManager.QueueNotification (notification2);
		
	


98 comments

Loading...

Next up

Smile! Here, take some happy pills! ✨💊 #Blender #3DModelling #3DArt Buy me a Ko-fi: https://ko-fi.com/barbarafb_

We made a lot of improvements on the Freezing Plains visual. Things like pine trees, tiny bushes, some rocks, and others game props!

#IndieGame | #IndieDev | #GameDev | #PixelArt | #WaifuQuest | #WifeQuest | #screenshotsaturday

A house I've built a while ago. :)

It nicely separates the snowy biome from the grassy one.

It's built with painted Ebonstone.

Shuiro Haname. #Commission

Commission for @ShuHaname

Why walk when you can jump?

I mostly build 3D First Person Shooter game mechanics in Unity, and in this I'm just showing C4 mechanics I made for a little side project I am working on! :)

I did this on my 3DS ^^ #Kirby

A few screenshots of the places you'll cross in the Demo of Blu. You can play it today on #gamejolt !

We're knee deep in multiple large features and "game feel". Quick peek behind the scenes in this weeks Dev Blog: https://bit.ly/2QmmaQM

A 1h30 painting, coffee break.

My twitter: https://twitter.com/loupil100