I am trying to repeat a command that adds a component using the “Add Component” button.
I need to create the same ImagePlateComponent for SceneComponent but with Python code.
But the ImagePlateComponent generated by the python code is different from the one created through the “Add Component” button:
for i in range(scene_component.get_num_children_components()):
print scene_component.get_child_component(i)
LogPython: <Object '/Game/fbxLevel.fbxLevel:PersistentLevel.cam_for_UE.CameraComponent' (0x000001CA2F795600) Class 'CineCameraComponent'>
LogPython: <Object '/Game/fbxLevel.fbxLevel:PersistentLevel.cam_for_UE.ImagePlate' (0x000001CA2B87C100) Class 'ImagePlateComponent'>
LogPython: <Object '/Engine/Transient.ImagePlateComponent_0' (0x000001CA2B5B1D00) Class 'ImagePlateComponent'>
- second line: the component created by the “Add Component” button - third line: component created by python code
I do not see the ImagePlateComponent (that creates the python code) in the Details panel.
**unreal.Actor **article says that a new component must be registered. But how to do that?
I can not find the required method
How do I add an ImagePlateComponent so that it displays under the SceneComponent as attachement?
Yes you don’t see it, and you won’t see it. From the tiny piece of logic you shared, i see you creating a component without defining which actor to hold it, so you kinda end up with a component in the air…in the memory.
I’m trying to do the same thing but via editor utility widgets. The component shows up for a few seconds in the world and then disappears, and its never added in the details panel for the selected/target actor. Did you ever find a way to do this?
You need to add a new node to the Blueprint’s SimpleConstructionScript so it’s serialized and properly registered. The easiest way to do this is a little hacky, but you can just instantiate a SSCSEditor widget and use that to add a component to a Blueprint or actor instance. This is exactly what the Blueprint editor uses when you click the +AddComponent button (SSCSEditor::AddNewComponent). You’ll have to wrap this functionality in a plugin or BlueprintFunctionLib to expose it to Python.