(:3[kanのメモ帳]

個人ゲーム開発者kan.kikuchiのメモ的技術ブログ。月木更新でUnity関連がメイン。

(:3[kanのメモ帳]


本ブログの運営者kan.kikuchiが個人で開発したゲームです!

    

プレイヤーの名前を取得して表示する方法【UEFN】【Verse】


このエントリーをはてなブックマークに追加



この記事でのバージョン
Unreal Editor for Fortnite(UEFN) 26.30


はじめに

今回はタイトル通り、UEFNでプレイヤーの名前を取得して表示する方法の紹介です。





プレイヤーの名前の取得して表示する方法

早速ですがプレイヤーの名前を取得するにはagentを元にmessageを作成します。

#Agentの名前を取得
GetAgentName<localizes>(Agent:agent):message="{Agent}"


なお、おそらく現状stringでは取得出来ないため、UIやビルボードなどの表示用になります。

例えばボタンを押したプレイヤー名をビルボードに表示しようとすると以下のような感じに。

#ボタンとビルボード(エディタ上で設定)
@editable
_button : button_device = button_device{}
@editable
_billboard : billboard_device = billboard_device{}

#開始時に実行される
OnBegin<override>()<suspends>:void=
    _button.InteractedWithEvent.Subscribe(OnInteractedButton) #ボタン押した時の処理登録

#ボタンが押された
OnInteractedButton(Agent : agent) : void=
    #ビルボードにユーザ名を設定
    _billboard.SetText(GetAgentName(Agent))

#Agentの名前を取得
GetAgentName<localizes>(Agent:agent):message="{Agent}"


ただしフォーラムで以下のような返答がEpicスタッフからされているため、

今後も同様の方法で取得出来るかは分かりません。

Hey folks! Sorry for the confusion this has caused. The ability to use text argument modifiers from verse is going to be removed in 27.00 and replaced with a pure verse version in the future. Apologies again for the confusion on this one.

みなさん!混乱を招いて申し訳ありません。27.00ではverseのテキスト引数修飾を使用する機能は削除され、将来的には純粋なverseバージョンに置き換えられる予定です。この件での混乱を再度お詫びします。
DeepL翻訳