# Why const UFUNCTIONS?

**URL:** <https://forums.unrealengine.com/t/why-const-ufunctions/301511>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [December 13, 2014, 7:50pm UTC](https://forums.unrealengine.com/t/why-const-ufunctions/301511 "2014-12-13T19:50:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![BeariksonStudios](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@BeariksonStudios](https://forums.unrealengine.com/u/BeariksonStudios)\
**Post date:** [December 13, 2014, 7:50pm UTC](https://forums.unrealengine.com/t/why-const-ufunctions/301511/1 "2014-12-13T19:50:58Z")

</div>

When interacting with blueprints though C++, you can modify the C++ members through `UPROPERTY`s to your heart’s content, but when it comes to `UFUNCTION`s, the inputs need to remain `const`. Why is that?

I have a situation where I want UMG to launch a rocket to another planet when I hit a button, and have the rocket class internally track the destination until it arrives:

```
UFUNCTION(BlueprintCallable, Category = "Mechanics")
			virtual void launch(AActor* &destination);

```

`AActor* &destination` would need to be non-const, because the member I’m assigning that destination to will repeatedly change as the rocket goes from planet to planet. Unfortunately, even though the `return` is `void`, it still sets up `&destination` as an output in the blueprint.

I also have a function that should allow UMG to set the rocket’s location based on actor and offset from the actor:

```
UFUNCTION(BlueprintCallable, Category = "Mechanics")
	virtual void setLandedLocation(AActor* &body, const FVector offset = FVector(0, 0, 0));

```

The parameter `AActor* &body` also needs to be non-const, because the body will eventually change when the rocket goes from planet to planet.

Abstracting away members and variables is nice way to keep classes bug-free, so I’m slightly confused as to why OOP getters and setters are not allowed in UFUNCTIONS.

Am I missing something here?

Thank you,  
BeariksonStudios
