Unity Integration
Step 1: Create SDK Script
Create LootlyCasherSDK.cs in Assets/Scripts:
LOOTLYCASHERSDK.CS
using UnityEngine;
public class LootlyCasherSDK : MonoBehaviour
{
private static LootlyCasherSDK _instance;
public static LootlyCasherSDK Instance
{
get
{
if (_instance == null)
{
GameObject go = new GameObject("LootlyCasherSDK");
_instance = go.AddComponent<LootlyCasherSDK>();
DontDestroyOnLoad(go);
}
return _instance;
}
}
private string baseURL = "https://lootlycasher.online";
private string apiKey;
private string userId;
private string deviceId;
private bool sandbox;
public void Initialize(string apiKey, string userId, string deviceId = "", bool sandbox = false)
{
this.apiKey = apiKey;
this.userId = userId;
this.deviceId = deviceId;
this.sandbox = sandbox;
Debug.Log("LootlyCasher initialized for user: " + userId);
}
public void ShowOfferwall()
{
string sandboxParam = sandbox ? "&sandbox=1" : "";
string url = baseURL + "/api/offerwall/" + apiKey +
"?user_id=" + userId + "&device_id=" + deviceId + sandboxParam;
Application.OpenURL(url);
}
}