# Getter value not being pulled through

**URL:** <https://forums.unrealengine.com/t/getter-value-not-being-pulled-through/447596>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [April 21, 2019, 6:04pm UTC](https://forums.unrealengine.com/t/getter-value-not-being-pulled-through/447596 "2019-04-21T18:04:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![JayFitz91](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JayFitz91](https://forums.unrealengine.com/u/JayFitz91)\
**Post date:** [April 21, 2019, 6:04pm UTC](https://forums.unrealengine.com/t/getter-value-not-being-pulled-through/447596/1 "2019-04-21T18:04:58Z")

</div>

Hi,

I am trying to increase my score when an overlap event occurs, the code is called correctly but the value contained within the overlapped actor is not being pulled through.

For example, I spawn a powerup into the scene, it’s powerupvalue is set to 50

![274832-powerupvalue.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/b/f/9bf85b5e7e76566041c1cb11d6af800128ac8f7b.png)

When the overlap event happens, I call the following line of code:

```
void APaddle::BeginOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult &SweepResult)
{
	if ((OtherActor != nullptr) && (OtherActor != this) && (OtherComp != nullptr))
	{
		APowerup* const CollidedPowerup = Cast<APowerup>(OtherActor);
		if (CollidedPowerup)
		{
			SetScore(CollidedPowerup->GetPowerupValue());
			UE_LOG(LogTemp, Warning, TEXT("Current Score: %d"), GetScore());
			CollidedPowerup->Destroy();			
		}
	}
}

```

The destroy part of the code works, but the value of the log always returns 0.  
If I run the following line of code within this snippet of code:

```
UE_LOG(LogTemp, Warning, TEXT("Powerup Score: %d"), CollidedPowerup->GetPowerupValue());

```

The value returned is also 0, but if I spawn a powerup and check it’s properties in Details tab as mentioned above, I can see that the powerup value is set to 50.

Why is this happening?

---

<div class="post-metadata">

**Author:** ![JayFitz91](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JayFitz91](https://forums.unrealengine.com/u/JayFitz91)\
**Post date:** [April 21, 2019, 6:52pm UTC](https://forums.unrealengine.com/t/getter-value-not-being-pulled-through/447596/2 "2019-04-21T18:52:22Z")

</div>

Just an update to say the CurrentScore is successfully updated on my player actor when I check the Details tab, it just seems to be in the editor it is not updating

---

<div class="post-metadata">

**Author:** ![JayFitz91](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JayFitz91](https://forums.unrealengine.com/u/JayFitz91)\
**Post date:** [April 22, 2019, 11:31am UTC](https://forums.unrealengine.com/t/getter-value-not-being-pulled-through/447596/3 "2019-04-22T11:31:30Z")

</div>

I’ve been trying to troubleshoot why this is not working and I’m fairly certain its a bug/UI issue. I created a widget that keeps track of the score by using the GetScore() function. When I collect a powerup, the UI widget updates correctly, so it is only the editor which displays the incorrect value

---

<div class="post-metadata">

**Author:** ![JayFitz91](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JayFitz91](https://forums.unrealengine.com/u/JayFitz91)\
**Post date:** [April 22, 2019, 12:35pm UTC](https://forums.unrealengine.com/t/getter-value-not-being-pulled-through/447596/4 "2019-04-22T12:35:05Z")

</div>

I found out why this is not working, I was using the wrong formatting value. My CurrentScore variable is a float so I should have been using %f in the Text. %d is used for integers so if I change the line of code from

```
UE_LOG(LogTemp, Warning, TEXT("Current Score: %d"), GetScore());

```

to

```
UE_LOG(LogTemp, Warning, TEXT("Current Score: %f"), GetScore());

```

The Output Log displays the correct value, more information can be found on the Unreal Wiki below:

> **[A new, community-hosted Unreal Engine Wiki](https://forums.unrealengine.com/t/a-new-community-hosted-unreal-engine-wiki/141494)**
>
> After over a year in maintenance mode, the official Unreal Engine Wiki is now permanently offline. These resources now live on a new community-run Unreal Engine Community Wiki — ue4community.wiki! You will be able to find content from the official...
