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
I have used UPROPERTY on C++ but I have no idea how to do it in Python
this is the code I’m using
actor = unreal.EditorLevelLibrary.get_selected_level_actors()
instance_component = unreal.InstancedStaticMeshComponent()
instance_component.attach_to_component(actor.root_component, ' ', unreal.AttachmentRule.KEEP_WORLD, unreal.AttachmentRule.KEEP_WORLD, unreal.AttachmentRule.KEEP_WORLD, False)
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
did u ever figure this out?
not using Python, I created a C++ function that creates the component and adds the proper permissions, and I call that from Python, never got an answer neither here or on the forums
Yeah i ended up doing the same,but for some reason i cant see the new component in the details panel (parented under root), when i generate the component in editor thru Python.
actually figured it out,in C++ was missing “AddInstanceComponent”
yeah that’s important
I also run RegisterComponent() since I was doing this from a blueprint library
Having issues on the undo/redo from these custom components being called from Python (ie: i move the transform of the component in the scene, and undo) . Have you come across this issue?
Yes, that happens to me as well, wasn’t sure why that was
Actually figured it out, in case ure curious… u need to take the NewObject and set it to be RF_Transactional.
void ADDBaseActor::GenerateHism(UHierarchicalInstancedStaticMeshComponent*& NewComp, FName Name)
NewComp = NewObject<UHierarchicalInstancedStaticMeshComponent>(this, HiStaticMesh->StaticClass(), Name);
oh thank you very much I will make that change, Cheers!