Unprofane

Unity username check.

A coroutine for the live hint in the name field, with the real check on your server.

Runs in C#, in the client and on your server. Every name is checked with context: "username" and the teen policy; change the policy to suit the audience. Replace the key.

// Call from your own server in production; a secret key never ships in a build.
// For a client-side username field use a publishable key (up_pk_…) with an origin allowlist.
using UnityEngine.Networking;
IEnumerator CheckUsername(string username, System.Action<bool> done) {
    var body = JsonUtility.ToJson(new { text = username, context = "username", policy = "teen" });
    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();
    done(req.result == UnityWebRequest.Result.Success && req.downloadHandler.text.Contains("\"allowed\":true"));
}

Notes

A build is not a browser: the origin allowlist cannot protect a key inside it, and a key inside it is readable. Use a publishable key for the hint and check the final name from your server with a secret key.

What the response holds, and how to read a reserved name apart from a profane one, is in the API reference. The other recipes are on the username page.