Share API
Share API
Share(templateId, templateArgsJson, onSuccess, onFail)
Opens the platform share sheet with a template ID and arguments (message metadata such as title and description, as JSON) agreed with the platform. It is unrelated to rewards (for rewarded sharing use the unified rewarded slot with action=SHARE) and is meant for shares whose content differs per call, such as multiplayer invitations. The platform handles the share UI; the SDK only receives the result.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
templateId | string | ✅ | A positive-integer string (Kakao message template ID), "default" (the game's default template), or a template name registered with the platform. How "0" and unregistered names are handled follows the per-host table below |
templateArgsJson | string | - | JSON of an object whose values are all strings (at most 32 entries, 2048 characters per value, 8192 characters serialized in total — counted in UTF-16 code units). Default "{}" |
onSuccess | Action<ShareResult> | - | Success callback — success means "the share sheet was opened" |
onFail | Action<string> | - | Failure callback |
Success Response (ShareResult):
| Field | Type | Description |
|---|---|---|
completed | bool | Whether the share completed — meaning per host in the table below. false when unknown |
Behavior per host:
| Host | How templateId is interpreted | completed |
|---|---|---|
| KakaoTalk | A positive-integer string (Kakao message template ID), "default", or a registered template name. Arguments (TITLE, DESCRIPTION, THU, BUTTON_TEXT, etc. — varies by template) override the game's registered values; the launch link is set by the platform. However, arguments registered as link parameter keys (such as a room code) go into the launch link's query rather than the message body — keys may contain only letters, digits, _ and - (≤64 chars), values are arbitrary strings of ≤512 chars, at most 20 parameters and 2048 chars of parameters in total (6144 chars after URL encoding); reserved keys (referer, t_src, t_ch, t_obj, code, state, authCode, error, etc.) cannot be used, empty-string values are simply not sent (not a failure), and a constraint violation fails with share unavailable. Unregistered names and "0" fail | Always false — the sheet does not report completion or cancellation |
| KakaoPay | Games without registered templates share TITLE and DESCRIPTION plus the platform link as text regardless of templateId (other arguments are ignored). For games with registered templates, "default" and positive integers share as text (this path carries no link parameters, so send invitations through a named template), a registered name opens the KakaoTalk share sheet (KakaoPay app 26.7.0 or later — older apps and outside the app fall back to text) where the game's text/image arguments (TITLE, DESCRIPTION, THU, BUTTON_TEXT) are ignored and only the approved registered copy is sent — only arguments registered as link parameter keys are put into the link (keys and values of 1–64 letters, digits, _ or -, at most 20 parameters, link ≤2048 chars — otherwise invalid deeplink params; empty-string values are simply not sent (not a failure), and the keys code, _hash and share_link are accepted on send but dropped by the receiver, so do not use them). Unregistered names and "0" fail | Means the sheet was opened and closed (not a completion guarantee) |
| monimo | templateId and arguments are ignored; the platform's fixed link is shared | Whether the share actually happened |
Other hosts (environments whose servicePlatform is house) | Depending on the platform, templateId and arguments are ignored and the platform's fixed link (or TITLE/DESCRIPTION text) is shared through the OS share sheet, or sharing is unsupported and the call fails with onFail. They cannot be told apart by the servicePlatform value, so handle the failure | Whether the share actually happened when shared through the OS (false when no OS share sheet was available — it fell back to copying the link or succeeded without sharing); - when unsupported |
TudadaSDK.Instance.Share(
templateId: "default",
templateArgsJson: "{\"TITLE\":\"Play with me!\",\"DESCRIPTION\":\"Room code ABCDEF\"}",
onSuccess: (result) => Debug.Log("Share sheet opened, completed: " + result.completed),
onFail: (err) => Debug.LogWarning("Share failed: " + err)
);
In the Editor, the call succeeds immediately with completed = true and no share sheet.
The reward-based share API (ShareForReward) has been replaced by the unified rewarded slot and is kept for compatibility ([System.Obsolete] attribute — using it produces a compile warning). For new integrations, retrieve slots with GetRewardedAdSlots() and run them via ShowRewardedAd(slot) (action=SHARE).
ShareForReward(url, onSuccess, onFail)
Executes a reward-based share. The share UI and reward decision are handled by the platform; the SDK only receives the final result.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | - | URL to share (nullable) |
onSuccess | Action<ShareForRewardResult> | - | Success callback |
onFail | Action<string> | - | Failure callback |
Success Response (ShareForRewardResult):
| Field | Type | Description |
|---|---|---|
rewarded | bool | Whether reward was granted |
// Reward-based share
TudadaSDK.Instance.ShareForReward(
url: "https://example.com/share",
onSuccess: (result) => {
if (result.rewarded)
{
Debug.Log("Share complete - reward granted");
}
},
onFail: (err) => Debug.LogError("Share failed: " + err)
);
// Call without URL
TudadaSDK.Instance.ShareForReward(
onSuccess: (result) => Debug.Log("Rewarded: " + result.rewarded)
);