# Added support for "Optional" data type (TOptional\<T\>) in Blueprints

**URL:** <https://forums.unrealengine.com/t/added-support-for-optional-data-type-toptional-t-in-blueprints/1961936>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine, Blueprint, CPP\
**Created:** [August 4, 2024, 8:35pm UTC](https://forums.unrealengine.com/t/added-support-for-optional-data-type-toptional-t-in-blueprints/1961936 "2024-08-04T20:35:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![GabUECV](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/gabuecv/32/1194717_2.png) [@GabUECV](https://forums.unrealengine.com/u/GabUECV)\
**Post date:** [August 4, 2024, 8:35pm UTC](https://forums.unrealengine.com/t/added-support-for-optional-data-type-toptional-t-in-blueprints/1961936/1 "2024-08-04T20:35:37Z")

</div>

I recently added a new functionality that I find missing in UE: the support of the **Optional** type in Blueprints (aka. `TOptional<T>` in C++)

![Optional1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/8/5/e85154029e3bbeebedd541e1ef3ba674fef9d389.png)

I guess I am not the first one which seemed to look for that: [Post 1](https://forums.unrealengine.com/t/how-to-create-new-custom-generic-blueprint-containers-like-tarray/1214219/3), [Post 2](https://forums.unrealengine.com/t/ue-doesnt-like-my-toptionals/1166248/7), [Post 3](https://forums.unrealengine.com/t/advanced-types-into-uproperty/560624)

So I decided to do the hard work. After some non trivial changes in UE code, I finally managed to get this working, and landed a PR. Maybe UE Team will accept it (or maybe not, because there is many changes 😉).

=\> [https://github.com/EpicGames/UnrealEngine/pull/12197](https://github.com/EpicGames/UnrealEngine/pull/12197)

Feel free to test if you want !

For those who don’t have access to the UE Github, here is an extract of PR description, with a bit more context and info:

_Hi,_

_I have noticed some changes last year related to implementing support for TOptional data type in the UObject system, essentially through a new FOptionalProperty, as well as some preliminary support for such properties on the GUI side._

_Though, as of current development version of UE5, this is not yet fully implemented: FOptionalProperty is only supported at the very low level side (serialization), and the very high level side (the GUI). But there is no “glue” between the two !_

_So I decided to bridge this gap, and implement full support of the FOptionalProperty to most of the UE subsystems, and in particular, to Blueprints._

_ **Functionality Overview** _

_Basically, you can now have `Optional<T>` variables/parameters in Blueprints, as well as exposing them from C++._

_In the Editor, Optional are integrated as a new “container” type, like Arrays, Maps and Sets:_

![Optional1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/8/5/e85154029e3bbeebedd541e1ef3ba674fef9d389.png)

_Conceptually, an Optional can be viewed as a “container” of 0 or 1 item. This fits quite well with the existing implementation of the containers properties: they have an inner type (=\> the Optional type), you can get items (=\> get the Optional value), add an item (=\> set the Optional value), check for emptiness (check if the Optional is set), clean the items (=\> unset the Optional)._

_Optional variables are editable in the usual property editors thanks to the preexisting GUI support that was never used up until now (the “Set to Value” / “Unset” buttons were in fact already implemented since some time):_

![Optional2](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/6/2/862f6a07a9a13f7443ed78979a8666decb245ecd.png)

_All the existing common types are supported, as variables, local variables, function/event parameters, function return values, macros arguments, sub-graphs, etc. :_

![Optional3](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/b/3/5b3b64d47c3f7bd768cff0ebef7e3bfc701d7b58.png)

_Like with other containers types, it is not possible to nest Optionals in another container. You have to rely on an intermediate struct for that._

_Speaking of structs, their are supported too: you can define attributes of an Optional type. Indirectly, this means Optionals are also supported in Data Tables (with a limitation, see next section)._

_A small set of functionalities have been implemented to support Optional manipulation from BP graphs, with the usual “Get / Is Set / Unset” functions, as well as support for “Set By Ref” node :_

![Optional4](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/6/a/c6ab357cb990d6db5749e35c4326fd698c39dd13.png)

 ![Optional5](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/c/7/1c7cd3ce8cd2074f316ced87153d4b34caa0513d.png)

_Additionally, a convenience “Make Optional” node is provided too, modeled around the existing “Make Container” node :_

![Optional6](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/b/3/1b32444e4c68a4cc5d1a7c639eaa8c66f6633b50.png)

_(on the picture, right-clicking on the “Make Optional” node shows either “Set Value” or “Unset Value” menu actions)_

_Incidentally, the support of the optional type in Blueprint allows for optional parameters/arguments to functions, as I have made optionals default-constructible (to an unset value):_

![Optional7](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/f/5/bf527d5ce2741142da65ec9e8eaf38e6fb0e8f73.png)

_Finally in C++ code, optionals can be exposed as `UPROPERTY(...) TOptional<T>`, as well as parameters to UFUNCTIONS, for each supported function types: BlueprintCallable, BlueprintNativeEvent, BlueprintImplementableEvent_

[…] Implementation details and notes in the PR

---

<div class="post-metadata">

**Author:** ![Rumzie](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Rumzie](https://forums.unrealengine.com/u/Rumzie)\
**Post date:** [November 19, 2024, 4:37pm UTC](https://forums.unrealengine.com/t/added-support-for-optional-data-type-toptional-t-in-blueprints/1961936/2 "2024-11-19T16:37:03Z")

</div>

TOptional\<\> should absolutely be a supported property type in the engine. +1

---

<div class="post-metadata">

**Author:** ![oakisnotree](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@oakisnotree](https://forums.unrealengine.com/u/oakisnotree)\
**Post date:** [July 7, 2025, 6:33am UTC](https://forums.unrealengine.com/t/added-support-for-optional-data-type-toptional-t-in-blueprints/1961936/3 "2025-07-07T06:33:57Z")

</div>

Perfect, this definitely should be added. Is this already merged? Cant find it anywhere ☹

---

<div class="post-metadata">

**Author:** ![David\_Morasz](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/david_morasz/32/247970_2.png) [@David\_Morasz](https://forums.unrealengine.com/u/David_Morasz)\
**Post date:** [June 10, 2026, 7:12pm UTC](https://forums.unrealengine.com/t/added-support-for-optional-data-type-toptional-t-in-blueprints/1961936/4 "2026-06-10T19:12:29Z")

</div>

FYI, Since this is one of the top hits for searching this topic on Google, UE 5.4 introduced `TOptional<T>` as a supported type under UProperties in UStructs and UObjects. I’m not sure if they’re handled nicely in BP and/or in Details panel, like OP very elegantly implemented.

So yay there’s now a vanilla implementation too.
