I’m loading a USkeletalMesh in runtime and then loading a UMaterial to assign to it. I then want to swap that material for another one (changing it’s appearance). Obviously I can just load a new UMaterial but what would happen to the old one? Ideally I want to unload it so it gets collected by garbage collection but I don’t know how. Here’s how I’m loading them:
// Skeletal mesh
USkeletalMesh *skeletalMesh = Cast<USkeletalMesh>( StaticLoadObject( USkeletalMesh::StaticClass(), NULL, *pathIn ) );
// Material
UMaterial *material = Cast<UMaterial>( StaticLoadObject( UMaterial::StaticClass(), NULL, *pathIn ) );
And one more question; If I call StaticLoadObject(…) with the same path, will it create two instances of that object or will it only create one the first time it’s called, and then return a ptr to that first instance?
Thank you