アンリアる! C++入門編 ~対話形式で学ぶUnreal Engine~
BOOTHでUnreal Engine C++入門書を販売していますUnreal Engine上でC++を使って開発するために必要となる基礎知識を一冊の本にまとめた本です。 対話形式によるわかりやすい説明を目指しました。無料の試し読みも可能ですので、ぜひ読んでみてください!
Released Unrael Engine Plugin “Access Variable by Name”

We recently released the Unreal Engine plugin "Access Variable by Name".
"Access Variable by Name" provides a Blueprint node that allows you to get/set the value of a variable by specifying a string.

Marketplace: Access Variable by Name

This article describes the Blueprint node provided by the plugin.

Get Variable by Name

"Get Variable by Name" is a Blueprint node that allows you to get the value of a variable by specifying string.
It parses the specified string and automatically changes the data type of the output pin.
This node is very useful when you access variables of other classes or when you access nested variables using custom syntax.

Set Variable by Name

"Set Variable by Name" is a Blueprint node that allows you to set the value of a variable by specifying string.
It parses the specified string and automatically changes the data type of the input/output pin.
This node is very useful when you access variables of other classes or when you access nested variables using custom syntax.

Get Variable by Name (Dynamic)

"Get Variable by Name (Dynamic)" is a Blueprint node that allows you to get the value of a variable by specifying string.
This node has the same features as "Get Variable by Name", but non-literal values can be specified as strings.
Since a string can be specified at runtime, the target variable can be changed dynamically at runtime.
However, you must specify the data type of the output pin.

Set Variable by Name (Dynamic)

"Set Variable by Name (Dynamic)" is a Blueprint node that allows you to set the value of a variable by specifying string.
This node has the same features as "Set Variable by Name", but non-literal values can be specified as strings.
Since a string can be specified at runtime, the target variable can be changed dynamically at runtime.
However, you must specify the data type of the input/output pin.

Custom Syntax

Custom syntax is available for specifying variable names as strings.

Access to member variables of Structure and Object

By separating the string with a dot (.) separating the strings, you can access to member variables of Structure and Object.
The following example is a string to specify when accessing the member variable X of the variable StructVar of Vector type.

StructVar.X

Access to Array and Map elements

Elements of Arrays and Maps can be accessed directly by enclosing the element number or key in the square brackets ([]).
The following example is a string when you access the third element of a variable ArrayVar of Array type.
Note that it follows a 0-based index.

ArrayVar[2]

Similarly, below string is specified when you access the element corresponding to the key Key of a variable MapVar of Map type.

MapVar["Key"]

Syntax Combinations

Custom syntax can also be combined.

Summary

This article introduced the Blueprint node provided by the plugin "Access Variable by Name".
We have also uploaded an introduction video to YouTube, so please check it out.

We also have a free trial version available on GitHub.
We hope you will like it and consider purchasing it on Marketplace.

GitHub: colory-games/UEPlugin-AccessVariableByName

Note that the free trial version differs from the regular version in the following limitations.

  • Certain types are not available
    • Struct
    • Enum
    • Array
    • Set
    • Map
  • Custom Syntax is not available