# \[Feature Request\] Additional default value support for UFUNCTION

**URL:** <https://forums.unrealengine.com/t/feature-request-additional-default-value-support-for-ufunction/566155>\
**Category:** Feedback & Requests\
**Tags:** unreal-engine, FeatureRequest, UE4-26, question, Blueprint\
**Created:** [May 25, 2022, 1:30pm UTC](https://forums.unrealengine.com/t/feature-request-additional-default-value-support-for-ufunction/566155 "2022-05-25T13:30:48Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Roy\_Wierer.Seda145](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/roy_wierer.seda145/32/906551_2.png) [@Roy\_Wierer.Seda145](https://forums.unrealengine.com/u/Roy_Wierer.Seda145)\
**Post date:** [May 25, 2022, 1:30pm UTC](https://forums.unrealengine.com/t/feature-request-additional-default-value-support-for-ufunction/566155/1 "2022-05-25T13:30:48Z")

</div>

Some datatypes used in UFUNCTION parameters apparently do not support default values.  
For example:

```auto
UFUNCTION(BlueprintCallable)
	void AddSlotToGrid(FIntPoint InPosition = FIntPoint(0, 0));

```

Results in a build error that the default value could not be parsed.  
The datatype FIntPoint and others like FIntVector are fully supported in Blueprints, so why would a default value not be?

---

<div class="post-metadata">

**Author:** ![imakevideogames](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/imakevideogames/32/497397_2.png) [@imakevideogames](https://forums.unrealengine.com/u/imakevideogames)\
**Post date:** [May 25, 2022, 1:36pm UTC](https://forums.unrealengine.com/t/feature-request-additional-default-value-support-for-ufunction/566155/2 "2022-05-25T13:36:47Z")

</div>

Try this:

```auto
    UFUNCTION(BlueprintCallable, meta=(AutoCreateRefTerm="InPosition"))
    void AddSlotToGrid(const FIntPoint& InPosition);

```

Does that do what you want?

---

<div class="post-metadata">

**Author:** ![Roy\_Wierer.Seda145](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/roy_wierer.seda145/32/906551_2.png) [@Roy\_Wierer.Seda145](https://forums.unrealengine.com/u/Roy_Wierer.Seda145)\
**Post date:** [May 25, 2022, 2:26pm UTC](https://forums.unrealengine.com/t/feature-request-additional-default-value-support-for-ufunction/566155/3 "2022-05-25T14:26:00Z")

</div>

formatting an FIntPoint as “const FIntPoint& InPosition” gives the same error. meta AutoCreateRefTerm was included while testing.

> C++ Default parameter not parsed: InPosition “FIntPoint(0 ,0)”

Example of another function implementing that format:

```auto
UFUNCTION(BlueprintCallable, BlueprintPure = false, Category = "Grid", meta = (ToolTip = "", AutoCreateRefTerm="InSlotSize"))
	bool CanPlaceSlotAtPosition(FIntPoint InPosition, const FIntPoint& InSlotSize = FIntPoint(0 ,0)) const;

```

---

<div class="post-metadata">

**Author:** ![imakevideogames](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/imakevideogames/32/497397_2.png) [@imakevideogames](https://forums.unrealengine.com/u/imakevideogames)\
**Post date:** [May 25, 2022, 2:42pm UTC](https://forums.unrealengine.com/t/feature-request-additional-default-value-support-for-ufunction/566155/4 "2022-05-25T14:42:07Z")

</div>

If you add `meta=(AutoCreateRefTerm="InPosition")`, you can just omit the `FIntPoint(0,0)` and let the default constructor handle it… I think :-D.

---

<div class="post-metadata">

**Author:** ![Roy\_Wierer.Seda145](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/roy_wierer.seda145/32/906551_2.png) [@Roy\_Wierer.Seda145](https://forums.unrealengine.com/u/Roy_Wierer.Seda145)\
**Post date:** [May 25, 2022, 2:47pm UTC](https://forums.unrealengine.com/t/feature-request-additional-default-value-support-for-ufunction/566155/5 "2022-05-25T14:47:15Z")

</div>

> [@imakevideogames](#):
>
> and let the default constructor handle it

The goal is to set a default value in the parameter, which differs from what the default constructor sets. So if I want an FIntPoint(1, 1) I must be able to do this:

```auto
UFUNCTION(BlueprintCallable)
void SomeFunction(FIntPoint InPosition = FIntPoint(1, 1));

```

One case where this is useful is in a grid where a slot’s size defined as FIntPoint is X 1 Y1 by default since 0x0 does not make sense.

Requiring BP users to set up the input every time they call the function with a “make struct” node or by breaking the pin is not optimal at all, when a default input of FIntPoint(0, 0) is certain to result in error.

---

<div class="post-metadata">

**Author:** ![imakevideogames](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/imakevideogames/32/497397_2.png) [@imakevideogames](https://forums.unrealengine.com/u/imakevideogames)\
**Post date:** [May 25, 2022, 3:01pm UTC](https://forums.unrealengine.com/t/feature-request-additional-default-value-support-for-ufunction/566155/6 "2022-05-25T15:01:00Z")

</div>

Ah, I see, that makes sense.

---

<div class="post-metadata">

**Author:** ![Roy\_Wierer.Seda145](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/roy_wierer.seda145/32/906551_2.png) [@Roy\_Wierer.Seda145](https://forums.unrealengine.com/u/Roy_Wierer.Seda145)\
**Post date:** [May 25, 2022, 3:08pm UTC](https://forums.unrealengine.com/t/feature-request-additional-default-value-support-for-ufunction/566155/7 "2022-05-25T15:08:08Z")

</div>

Some data types work just fine with UFUNCTION. bool, int32, FVector, so it must be some kind of missing support for the remaining data types.  
For example, this works just fine:

```auto
UFUNCTION(BlueprintCallable, BlueprintPure = false)
  void Test(FVector InVar = FVector(1, 2, 3)) const;

```

The same method using FIntVector only works in the following format, without the specifiers BlueprintCallable and BlueprintPure:

```auto
UFUNCTION()
void Test(FIntVector InVar = FIntVector(1, 2, 3)) const;

```
