Profanity filtering users can't bypass.
A coroutine for the live hint in the name field, with the real check on your server.

Choose your player name
Everyone in the game will see it.
sh1tH3ad_69
Pick a different username.

Choose your player name
Everyone in the game will see it.
admin
That name is reserved.

Choose your player name
Everyone in the game will see it.
river_otter
Name saved
Build with a test key, 100 checks a month; switch to a live key when you ship.
Your own server, which checks the final name.
Any language works; the code below is TypeScript.
For the live hint in a WebGL build: a publishable key (up_pk_…) and your game page’s origin on the project in the dashboard.
Publishable keys need a plan.
The secret key lives on your server only, as UNPROFANE_API_KEY.
The publishable key goes in the build, where anyone can read it.
It can only call /v1/check, and only from the origins you list.
UsernameHint.cs on the name screen.
Start CheckUsername with StartCoroutine a moment after the player stops typing.
The server code goes in the route your game calls to save a name.
// UsernameHint.cs. WebGL builds only: the live hint as the player types, with a publishable
// key (up_pk_…) and your game page's origin allowed on the project. A desktop or mobile
// build sends no origin, so the key is refused there: have it ask your server instead.
// Either way your server checks the final name with a secret key; a key in a build is public.
using System;
using System.Collections;
using UnityEngine;
using UnityEngine.Networking;
public class UsernameHint : MonoBehaviour {
[Serializable] class CheckRequest { public string text; public string context = "username"; public string policy = "teen"; }
[Serializable] class CheckResult { public bool allowed; public string action; }
public IEnumerator CheckUsername(string username, Action<bool> done) {
var body = JsonUtility.ToJson(new CheckRequest { text = username });
using var req = new UnityWebRequest("https://api.unprofane.com/v1/check", "POST");
req.uploadHandler = new UploadHandlerRaw(System.Text.Encoding.UTF8.GetBytes(body));
req.downloadHandler = new DownloadHandlerBuffer();
req.SetRequestHeader("Authorization", "Bearer up_pk_YOUR_PUBLISHABLE_KEY");
req.SetRequestHeader("Content-Type", "application/json");
yield return req.SendWebRequest();
// No answer is not a no: the hint stays quiet and your server decides.
if (req.result != UnityWebRequest.Result.Success) { done(true); yield break; }
done(JsonUtility.FromJson<CheckResult>(req.downloadHandler.text).allowed);
}
}JsonUtility writes an anonymous one as {}./v1/check, and only from the origins you list.import { Unprofane } from '@unprofane/sdk';
let unprofane: Unprofane | undefined;
/** Returns the reason a username cannot be shown, or null when it can. Throws when Unprofane cannot answer. */
export async function usernameProblem(username: string): Promise<string | null> {
unprofane ??= new Unprofane(process.env.UNPROFANE_API_KEY!, { timeoutMs: 3_000, retries: 1 });
const r = await unprofane.check({ text: username, context: 'username', policy: 'teen' });
if (r.allowed) return null;
return r.matches[0]?.category === 'reserved'
? 'That name is reserved.'
: 'Pick a different username.';
}admin, support and your own brand come back reserved, so the person reads taken, not rude.Replace up_pk_YOUR_PUBLISHABLE_KEY with your key; nothing else changes. Every name goes with context: "username" and the teen policy.
The decision, on your server. The second tab, the raw HTTP recipe, checks the name with a secret key before it is saved.
On your server with a test key, check sh1tH3ad_69 (refused), admin (reserved) and river_otter (allowed).
In a WebGL build, type the same names and the hint follows.
In the editor or a desktop build the hint’s request answers 403, because those send no origin.
What your server’s check is run with
Six usernames a word list gets wrong, and what this check answered.
sh1tH3ad_69
Digits for letters
Misses it
ilovesh1t
Words run together
Misses it
tihs_xX
Written backwards
Misses it
admin
Not rude: a claim to be staff
Passes it
Dickinson
A poet’s surname
Blocks it
therapist_jo
A job
Blocks it
4 let through2 innocent blocked
4 turned away2 innocent let through
76.5%
Unprofane
Balanced mode, as the recipes run it
32.5%
Perspective API
Set to flag as much clean text as Unprofane
When it runs, what it does with each answer, and what usually goes wrong.
The hint is a courtesy, while the player types. The decision is your server’s, when the game sends the name to be saved: refuse the save there, whatever the client said.
allowed is true only when action is allow. The recipes turn away review as well as block: a username has no moderator queue, and asking for another name costs the person a few seconds. To accept a name held for review and look at it later, test action !== "block" instead and keep the user id where a person will read it. A name that claims to be the platform or its staff, such as admin, comes back with matches[0].category set to reserved, and the code says so in its own words.
Every field of the answer is in the API reference.
When the hint’s request fails, it calls done(true): the hint stays quiet and the player carries on. Your server then decides, and when Unprofane does not answer it, usernameProblem throws: refuse the save and ask the player to try again.
The C# is not run: there is no Unity in our CI. Its request is held to the API’s fields on every change. The server half is the raw HTTP recipe’s TypeScript, which is run on every change.
403: this origin is not allowedThe request came from a desktop, mobile or editor build, or from an origin not on the project’s list. Native builds ask your server instead.
400: the request body is not validKeep the [Serializable] classes: JsonUtility writes an anonymous type as {}.
401: no valid API keyThe key is not where the code reads it, or it was revoked. Set it again and deploy again.
402: a plan is requiredA live or publishable key needs a plan. Build with a test key (up_test_…), which needs none.
429: too many requestsA test key’s free checks are capped across the account, a month’s with no plan and a day’s on one, and every plan has a per-minute limit. The answer’s type says which.
Every error, and what to send instead, is on the errors page.
Each recipe is a complete file, run the same way.
Paste the file, set the key, and send it sh1tH3ad_69, admin and river_otter.