Hi all~
Now I need to get a mesh’s content path when playing game.
For example.There is an AActor in my scene.
It has a UStaticMeshComponent…
I want to know what UStaticMeshComponent’s path in the content folder…
How can I get it?
I have search for some answer…But most of then were about houw to create AActor from path.And all I want is different from them…
Okay…This is a stupid question.And I finally figure out by myself…I dont know how to delete this question.So I put my answer here …
I mixed up UStaticMeshComponent and UStaticMesh…
Actually,I need the path of UStaticMesh instead of UStaticMeshComponent…But I always try to get the UStaticMeshComponent’s path,So I get the wrong answer…
UStaticMeshComponent* Mesh = Cast(AllActors[i]->GetComponentByClass(UStaticMeshComponent::StaticClass()));
if (Mesh != NULL)
{
UStaticMesh* StaticMesh = Mesh->StaticMesh;
FString MeshPath = Mesh->StaticMesh->GetPathName();
UE_LOG(LogClass, Warning, TEXT(“Mesh:%s”), *MeshPath);
}
And this is what i need…
No matter what,Thanks.
Okay…This is a stupid question.And I finally figure out by myself…I dont know how to delete this question.So I put my answer here …
I mixed up UStaticMeshComponent and UStaticMesh…
Actually,I need the path of UStaticMesh instead of UStaticMeshComponent…But I always try to get the UStaticMeshComponent’s path,So I get the wrong answer…
UStaticMeshComponent* Mesh = Cast(AllActors[i]->GetComponentByClass(UStaticMeshComponent::StaticClass()));
if (Mesh != NULL)
{
UStaticMesh* StaticMesh = Mesh->StaticMesh;
FString MeshPath = Mesh->StaticMesh->GetPathName();
UE_LOG(LogClass, Warning, TEXT(“Mesh:%s”), *MeshPath);
}
And this is what i need…
No matter what,Thanks.