This Package enables interaction with Totem services and assets in Unity.
You can install this package in three ways!
The suggested way to install this package is through the "Unity's Package Manager", with our GIT url. This way, you will be notified once new versions get released, and you will be able to download them directly from the Unity Editor.
1/ The GIT url you need to add to the Package manager is the following (copy and paste it): https://github.com/Totem-gdn/TotemGeneratorUnity.git
2/ In the Unity editor, open Window -> Package Manager to open the Package Manager, then click + -> Add package from git URL... -> paste the link above.
Still having trouble this way?
You can always check Unity's docs for how to install from git: https://docs.unity3d.com/Manual/upm-ui-giturl.html
You can also install this package manually, by copying the source files directly into your project's assets folder. (You'd have to do this every time there is a new update.)
1/ Head over to our releases tab: https://github.com/Totem-gdn/TotemGeneratorUnity/releases.
Download the requested version .unitypackage.
2/ In the Unity editor, open Assets -> Import Package -> Custom Package... -> navigate and select downloaded package and Voilà!
You can check the manual: https://docs.unity3d.com/Manual/upm-ui-giturl.html
Before building the application for Android/IOS you need to generate a deep link which can be easily done by going to Window > Totem Generator > Generate Deep Link and typing in your gameId
You can import samples through "Samples" menu in the Unity package details. Window -> Package Manager -> Totem Generator for Unity -> Samples
A sample that demonstrates how to do a basic plugin setup, retrieve avatars and use Legacy records.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TotemEntities;
using TotemEntities.DNA;
using TotemServices.DNA;
public class test : MonoBehaviour
{
///Id of your game
///Used for legacy records identification
private string _gameId = "TotemDemo";
// Start is called before the first frame update
void Start()
{
//Initialize TotemCore
TotemCore totemCore = new TotemCore(_gameId);
//Authenticate user through social login in web browser and get user's assets
totemCore.AuthenticateCurrentUser((user) =>
{
//Check if login was canceled
if (user == null)
{
return;
}
//Using default filter with a default avatar model. You can implement your own filters and/or models
totemCore.GetUserAvatars<TotemDNADefaultAvatar>(user, TotemDNAFilter.DefaultAvatarFilter, (avatars) =>
{
foreach (var avatar in avatars)
{
Debug.Log(avatar.ToString());
}
});
});
}
public void AddLegacyRecord(object asset, TotemAssetType assetType, int data)
{
totemCore.AddLegacyRecord(asset, assetType, data.ToString(), (record) =>
{
Debug.Log("Legacy record created");
});
}
public void GetLegacyRecords(object asset, TotemAssetType assetType, UnityAction<List<TotemLegacyRecord>> onSuccess)
{
totemCore.GetLegacyRecords(asset, assetType, onSuccess, legacyGameIdInput.text);
}
}