1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Console Variables Assetをレベル毎に自動でON/OFFする

Last updated at Posted at 2025-06-26

はじめに

Console Variables EditorというプラグインにConsole Variables Assetというアセットがあります。レベルを開いたら自動でその設定を読み込む処理を自作したときのメモです。
C++ではなくBPでサクッと作りました。
image.png
image.png

環境

  • Windows 11
  • UE 5.6

手順

レベルを開いたときに変更したいCVar設定をConsole Variables Assetに保存します。
アセットの置き場所は任意で大丈夫です。

例)あまり良くない例。。。テスト用なのでフォルダ分けしてないだけです。。。
image.png
image.png

レベルを開いたときの処理を入れるEditor Utility Blueprint(以降、EUBP)を作成します。
置き場所はお好みで。

例)
image.png

エディタ起動時にレベルを開いたときのイベント(OnMapOpened)にBindしたいので、
EUBPのRun on Start-upにチェックを入れます。
image.png

UE 5.6は上記にチェックを入れるだけOKです。簡単になったものです。

Runイベントを添付のようにします。
説明雑、、、
image.png

レベルを開いたときのConsole Variables Assetの更新処理(ResetConsoleVariablesAsset)は添付のような感じです。
登録されていないレベルを開いたときもThen 0が処理されるので、Console Variables Assetの設定がクリア状態(CVarがデフォルト)にちゃんと戻ります。
お手軽にMapでやっていますが、必要に応じて構造体などにしてください。
image.png

UpdateConsoleVariablesの中身は下記のような感じ。
BPだけでやると結構ハック的です。
Close Tab by IDですぐにウィンドウを閉じています。
ConsoleVariablesToolkitPanelTabIdの値はエンジンのソースコードConsoleVariablesToolkitPanelから持ってきています。多分変わらないでしょう。
image.png

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?