ErayT
(ErayT)
August 10, 2014, 1:05pm
1
Guys I want to load UStaticMesh during play.
static ConstructorHelpers::FObjectFinder<UStaticMesh> GroundShape(TEXT("StaticMesh'/Game/Shapes/Ground/ground_shape_2.ground_shape_2'"));
The above example is a good way but only avaliable during construction. I want to use such usage in BeginPlay().
TimGS
(TimGS)
August 10, 2014, 2:02pm
2
TimGS
(TimGS)
August 10, 2014, 2:39pm
3
Ok, I got it.
Then you may like this one [TUTORIAL] C++ - Runtime Async Load Modular Character (Intermediate) - Community Content, Tools and Tutorials - Unreal Engine Forums
Look at functions which load sceletal mesh components during runtime from database which has a collection of asset pointers. You could use this functionality for your static mesh I guess.
ErayT
(ErayT)
August 10, 2014, 2:27pm
4
The example you have mentioned is how to add a mesh or BP into the scene. What I want is to load the StaticMesh into the memory not the scene. There is no Spawing issue. At the end I want to have an object like
UStaticMesh* GroundMesh = <<missing part>>
ErayT
(ErayT)
August 11, 2014, 8:10am
5
void AGround::BeginPlay()
{
UStaticMesh* GroundMesh = Cast(StaticLoadObject(UStaticMesh::StaticClass(), NULL, TEXT(“StaticMesh’/Game/Shapes/Ground/ground_shape_2.ground_shape_2’”)));
GroundMeshComponent->SetStaticMesh(GroundMesh);
}
This is how I solved it based on the question :
https://answers.unrealengine.com/questions/61811/how-to-find-assets-without-constructor.html