Hello guys, I’ll describe what I do and what i want:
When i click on my actor of type AActor_cu_outline I spawn an actor of type AOutlineEffect in the exact same location,rotation and mesh but with a different material so i can artificially create an outline effect.
Now i want when i click on a different random actor in the scene to destroy this AOutlineEffect. Can you guys help me?I’m stuck on this from yesterday and i just can’t figure out how to do this.
I’ll attach my code here.
AActor_cu_outline.cpp:
void AActor_cu_outline::Creaza_Outline(UPrimitiveComponent* touchedComponent, FKey buttonPressed)
{
if (!are_outline)
{
FActorSpawnParameters SpawnInfo;
new_actor = GetWorld()->SpawnActor<AOutlineEffect>(GetActorLocation(), GetActorRotation(), SpawnInfo);
new_actor->GetMesh(this);
}
}
AOutlineEffect.cpp:
void AOutlineEffect::GetMesh(AActor_cu_outline* Actor)
{
this->mesh->SetStaticMesh(Actor->initial_mesh->GetStaticMesh());
this->mesh->SetMaterial(0, Actor->material);
mesh->SetScalarParameterValueOnMaterials(TEXT("Scale"),Actor->scale );
mesh->SetVectorParameterValueOnMaterials(TEXT("Color"),Actor->Color );
}