Skip to content

Social (Unity)

FRVRSDK.Social wraps the host channel’s share sheet and invite picker. Two actions: share (broadcast to the player’s feed / friends) and invite (target specific friends directly).

Not every channel supports these — always check first.

FRVRSDK.Social.CanInvite(canInvite =>
{
    inviteButton.gameObject.SetActive(canInvite);
});

If canInvite is false, hide the UI entry point — don’t show a button that does nothing.

The wrapper takes a base64 data URL for the image. Capture the texture, encode to PNG, base64‑encode the bytes, prefix with the data‑URL scheme:

string imageBase64 = "data:image/png;base64,"
    + System.Convert.ToBase64String(shareTexture.EncodeToPNG());

FRVRSDK.Social.Share(
    text:     "Beat my 42k in Fruit Sort FRVR!",
    image:    imageBase64,
    headline: "Share",
    cta:      "Play",
    result => Debug.Log("share result (1=ok, 0=fail): " + result));

With structured entrypoint data (so the receiving player lands in a specific state):

FRVRSDK.Social.Share(
    "Check this out!",
    imageBase64,
    "Headline",
    "Play Now",
    result => Debug.Log("share: " + result),
    "{\"deepLink\":\"daily_puzzle\",\"seed\":12345}");

The result callback is Action<int>1 means the host accepted the share, 0 means it failed (often “user closed the sheet without sharing”).

ArgumentTypeRequiredPurpose
textstringyesBody / description text.
imagestringyesImage as a base64 data URL (data:image/png;base64,…).
headlinestringyesShort headline above the body, where supported.
ctastringyesCall‑to‑action button label.
result callbackAction<int>yes1 on success, 0 on failure / cancel.
entryPointDataJsonstring (JSON)noSerialized payload delivered to the recipient via entry point on join. Defaults to "{}".
FRVRSDK.Social.Invite(
    text:               "Come play with me!",
    image:              imageBase64,
    headline:           "Join",
    cta:                "Play",
    entryPointDataJson: "{\"room\":\"abc\"}",
    result => Debug.Log("invite result (1=ok, 0=fail): " + result));

The host channel presents its native friend picker; the callback fires when the player finishes or cancels. Like Share, the result is Action<int>1 on success, 0 on cancel/failure. Note that entryPointDataJson is positional (5th argument), comes before the callback, and is required on Invite (unlike Share, which defaults it to "{}").

ArgumentTypeRequiredPurpose
textstringyesMessage shown alongside the image.
imagestringyesImage as a base64 data URL (data:image/png;base64,…).
headlinestringyesShort headline above the body, where supported.
ctastringyesCall‑to‑action button label.
entryPointDataJsonstring (JSON)yesSerialized payload available to the recipient through entry point on join. Pass "{}" if you don’t need one.
result callbackAction<int>yes1 on success, 0 on cancel / failure.

This is the most common “share returns nothing” bug. For EncodeToPNG() to produce non‑empty bytes, the shareTexture asset must have:

  • Read/Write Enabled: ON
  • Compression: None

Rough size guidance: 512×386 or 1024×768 work fine. Avoid huge textures — the base64 payload is what gets POSTed to the host, and you pay the serialise/transfer cost.

  • Share vs. invite semantics, full platform surface list (templated updates, friends graph, real‑time presence): Web SDK social reference.