> For the complete documentation index, see [llms.txt](https://lifeexe-art.gitbook.io/unreal-engine-c-course-eng/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lifeexe-art.gitbook.io/unreal-engine-c-course-eng/lessons/lecture-079/pickup-is-visible-after-the-ammo-has-been-taken.md).

# Pickup is visible after the ammo has been taken

### Problem

* Take pickup
* Get up on the pickup respawn point
* Spend all the ammo
* Pickup respawns
* Ammo is taken, but the pickup remains visible

### What's happening

This happens due to the wrong execution order in `ASTUBasePickup`:

```cpp
CollisionComponent->SetCollisionResponseToAllChannels(ECollisionResponse::ECR_Overlap);
if (GetRootComponent())
{
    GetRootComponent()->SetVisibility(true, true);
}
```

* Pickup respawns
* Collision is set to `ECollisionResponse::ECR_Overlap`
* `NotifyActorBeginOverlap` is called
* Pickup is taken and visibility is set to `false`
* But after that, visibility is set to `true` (line 4)

### Solution

Just change the order:

```cpp
if (GetRootComponent())
{
     GetRootComponent()->SetVisibility(true, true);
}
CollisionComponent->SetCollisionResponseToAllChannels(ECollisionResponse::ECR_Overlap);
```

[Commit in repository](https://github.com/life-exe/UnrealEngine/commit/e4954956c152d31b82d6357892de228002ac2866)
