Duplicate Actors with added Runtime Mesh Components after spawn


I spawn a custom Actor.
Fill it at runtime with Runtime Mesh Components.

And now I want to instantiate this Actor.
My hope is, that I only have to read/parse my fbx file and get fast copies of it with low impact on the memory.

So any one got an idea how i can approach this?

Hey SebaSopp,

can you please provide me will your full .cpp and .h file for your actor class? or if you could provide a screenshot of this actor’s blueprint? Thank you!

Hi Nicholas,

thx for your interest in this. I will try to explain the problem i’ve got with following blueprints:

So first I spawn my Actor Class (Fpo Model Handler). Here its empty.


Then I use assimp and the RuntimeMeshComponent Plugin to parse and handle a .fbx file.

By that a function creates custom SceneComponents for transformation and RuntimeMeshComponents for the meshes.
e.g. here the RuntimeMeshComponents are yellow highlighted.


This works all great. But sometimes I need the same actor 2 or 3 times with a different transformation.
For now I have to rebuild the actor for that every time.
But it would be great, if the actor could be instantiated (or copied if thats not possible)!

I hope the problem is now clearer :slight_smile:


Are you using any third party plugins?

The RuntimeMeshComponent Plugin and Assimp for the fbx parsing…

Hello Sebasopp,

I require additional information in order to investigate this issue further. Can you please provide the FPO Model actor blueprint? If the .Cpp file for this class is too big to post here, can you consider attaching the file to a dropbox, or google drive?


// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include <string>

//#include <assimp/scene.h>
#include "assimp/scene.h"
#include "Core.h"
#include "GameFramework/Actor.h"

#include "RuntimeMeshComponent.h"
#include "MySceneComponent.h"

#include "ActorSaveData.h"
#include "AssociationLists.h"
#include "FpoModelActor.generated.h"

class AFpoModelActor : public AActor


	// this necessary as UProperty?
	UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category=FpoModelActor)
		FPOModelMaterialMappingType MaterialMapType;


	bool AssimpMemToActor(const TArray<uint8>& FileData);
	void LoadFromRecord(FActorSaveData &ActorRecord);
	FActorSaveData SaveToRecord();

	// rather only material instances
	static UMaterialInterface* FindMaterial(FString materialName);
	static UMaterialInterface* FindMaterialInstance(std::string materialName);


	// muessen u.u. keine membervariablen mehr sein?
	TArray<FVector>				_vertices;
	TArray<int32>				_indices;
	TArray<FVector>				_normals;
	TArray<FVector2D>			_uvs;
	TArray<FRuntimeMeshTangent>	_tangents;
	TArray<FColor>				_vertexColors;

	void processNode(aiNode* node, const aiScene* scene, UMySceneComponent* parent);
	void processMesh(aiMesh* mesh, const aiScene* scene, UMySceneComponent* parent);


Hey Nicholas,
maybe the .h file helps first?

The constructer AFpoModelActor() creates only a RootComponent.
This and the other SceneComponents for the Transformations are customized SceneComponents (MySceneComponent) because of the need for serialization.

So after the FPOModelActor is created with its RootComponent, our BlueprintFunctionLibrary Function “LoadAssimpToActor” opens a fbx file and gives the data via “bool AssimpMemToActor(const TArray& FileData)” to the linked Actor that was created before.

With the data we create a Assimp Scene and start parsing the scene (processNode and processMesh). So we create MySceneComponents for the transformation-nodes and RuntimeMeshComponents for the mesh-nodes.

The meshes also getting materials associated.
By this way the Actor in the third picture above was created.

Now I need an instance of this Actor or a method to create a copy faster than building the Actor again up with all its nodes…

Have you tried creating a new blueprint class that inherits from your C++ AFpoModelActor()?

Here is an example of how to do so in the editor. First, right click on your content browser, and create a new blueprint class.

Then, click the arrow for all classes, you will be able to type in your class name.

Select your class, and this will create an instance of your actor to be modified in the blueprint editor.

That would only create a empty copy of the actor class inside the editor.
But I need the duplication of the actor at runtime of the game/application. After its filled.

Maybe I need to describe the problem clearer:
So in our application the user can import a fbx file at runtime.
Mostly car models with a high poly count.
I already explained the procedure of this import and creating/filling of a FpoModelActor.
Then they can position the car in front of a backplate.

But sometimes they want a copy of the same car on another position.
And here is the problem, for the copy of the car I have to read/parse the same fbx file again and fill a second FpoModelActor with the same SceneComponents and RuntimeMeshComponents. This costs time and memory.

But the data of the car is already in the first FpoModelActor!

So it would be perfect if i could create a copy (kind of memcpy) of the first FpoModelActor, at runtime!
Or Is there a way to clone/copy the components of an actor with hierarchy to another actor?