Hello. Using topdown template i made simple pickups, set the onclicked callback, but when i pick it up and call Destroy() the mesh disappears but collision remains (there is invisible obstacle) and my character tries to run around it. How to properly remove the pickup after being picked up?
My pickup is made of USphereComponent for collision and UStaticMeshComponent. USphereComponent (CollisionSphere) is RootComponent, Mesh is atatched to it. The invisible collision is caused not by sphere but by mesh (checked it by scaling the mesh it in editor)
I think its something similar to [BUG]: Static Mesh as root component doesn't remove collision when actor is destroyed - World Creation - Unreal Engine Forums
Are you using DestroyActor() or destroy on the component?
Im using Destroy() in OnClicked callback.
GEngine->AddOnScreenDebugMessage(12, 5.f, FColor::Yellow, FString("PICKED UP!"));
I also tried using PickupMesh->DestroyComponent(), PickupMesh->SetCollisionProfileName(“NoCollision”);
Even SetActorLocation outside map leaves that obstacle. I noticed that its not necessarily destroy() problem. When i relocate it to somewhere up the collision is still in spawning point!
but every try leaves the invisible collision
It happened only when i dragged and dropped the pickup in editor. When i use SpawnActor dynamically, everything works okay
I believe you should use GetWorld()->DestroyActor().
bool UWorld::DestroyActor( AActor* ThisActor, bool bNetForce, bool bShouldModifyLevel );
This will delete everything related to that actor. Let me know if this work for you!
, I has same issue, and it just disappeared when I check and change somne collisions in editir related to object. I change all to default again.
…, I`m following a UDemy tut by Reuben Ward, guess you did as well… ; ] ,