In case anyone else needs to update metadata for the account in UE blueprints, I managed it using VaRest:
And, the server code (Typescript) file update_metadata.ts:
let rpcUpdateMetadata: nkruntime.RpcFunction = function (ctx: nkruntime.Context, logger: nkruntime.Logger, nk: nkruntime.Nakama, payload: string): string {
if (!ctx.userId) { throw Error('No user ID in context'); }
if (!payload) { throw Error('Payload expected.'); }
let metadata = null;
try {
metadata = JSON.parse(payload);
} catch (error) {
logger.error('Error parsing: %q', error);
throw error;
}
let username = null;
let displayName = null;
let timezone = null;
let location = null;
let langTag = null;
let avatarUrl = null;
try {
nk.accountUpdateId(ctx.userId, username, displayName, timezone, location, langTag, avatarUrl, metadata);
} catch (error) {
logger.error('Could not update account: %q', error);
throw error;
}
return JSON.stringify({});
}
Also, make sure to edit your tsconfig.json to add “./update_metadata.ts” to the “files” array.
And, in main.ts update to:
...
const rpcIdUpdateMetadata = 'update_metadata_js';
function InitModule(ctx: nkruntime.Context, logger: nkruntime.Logger, nk: nkruntime.Nakama, initializer: nkruntime.Initializer) {
...
initializer.registerRpc(rpcIdUpdateMetadata, rpcUpdateMetadata);
...
}
Consider any code or blueprints I release on the forums to be licensed under MIT license and feel free to make use of them.
VaRest is located at (Just drop it in your Plugins, re-generate and build… I’ve confirmed it works on 5.4.4):