Download

Python - Attach component to Actor or Blueprint

Hello, please help
I’m trying to add a Instanced Static Mesh Component to and Actor
I just using the default Empty Actor
I manage to get the Component to be added but it tell me I can edit it
Native.jpg
I have used UPROPERTY on C++ but I have no idea how to do it in Python
this is the code I’m using



import unreal
actor = unreal.EditorLevelLibrary.get_selected_level_actors()[0]
instance_component = unreal.InstancedStaticMeshComponent()
unreal.uproperty(unreal.InstancedStaticMeshComponent())
instance_component.attach_to_component(actor.root_component, ' ', unreal.AttachmentRule.KEEP_WORLD, unreal.AttachmentRule.KEEP_WORLD, unreal.AttachmentRule.KEEP_WORLD, False)
actor.set_editor_property('root_component', instance_component)

It would be great if I can create the Empty Actor from the code as well, if that is possible. Thank you for your help

I also encountered this problem.Who can help .Thanks

anyone find a solution to this?

I want to know how to add components to a blueprint …