question

amazdeh avatar image
amazdeh asked

How to set user's displayname from server in unity?

I want to set my user's displayName from server but it seems that the server api doesn't have any APIs to do that, am I right?

If not, how can I do that. reasoning is that I want to apply validation and bad word filtering on the server

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Joshua Strunk avatar image
Joshua Strunk answered

If you are talking about from a custom server and not Cloud Script, you could make use of the Admin API.

Admin.UpdateUserTitleDisplayName

edit: Don't forget to disallow the client from calling UpdateUserTitleDisplayName for more info on that see this blog post.

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image brendan commented ·

Also, it's worth noting that we do offer an integration with CommunitySift in our add-ons marketplace, which does exactly that (checks for profane names and rejects them).

1 Like 1 ·
sevdanski avatar image
sevdanski answered

Sorry to bump an old thread, but I was wondering a similar thing - is it possible to change the DisplayName of a player via Cloud Script?

I was looking to enforce some rules on the display name (min/max length, characters, etc) and had planned on enforcing them on the server via cloud script, but I cannot find any api references - only admin and client, which I do not believe work in this context.

Any advice would be appreciated.

2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Andy avatar image Andy ♦♦ commented ·

While the cloud script can't actually do the update, you can absolutely use cloud script to vet a proposed new name before letting the client set it (or look into using Community Sift). It wouldn't be 100% secure, but would work in the majority of cases. You could also trigger some script off the display name changed event and verify it aligns with the proposed name change you received in the earlier call. If it doesn't, you can add the player to a "special" segment.

0 Likes 0 ·
sevdanski avatar image sevdanski Andy ♦♦ commented ·

Thanks for advice. I will look at creating a work around like that for the interim.

I might raise adding this api call in as an idea because I think it will be useful in the future for things like this.

Thanks again for all your help. You guys are awesome at responding.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.