Download

Create Object for Actor Class in Blueprint

I am trying to set the static mesh automatically (automated script) for all the components in Blueprint class ,what ever blueprint I select through scripted actions.

I am able to cast selected blueprint class to actor class. But I am not able to create object for actor to make use of GetComponentsByClass.

AS part of it, I am trying SpawnActorFromClass , but not able to find that function in Blueprint scripting… I am not sure if there is a better route to get the object from actor class which is not placed in the world

Could anyone help me with this

If you want to get all static mesh components, and set their mesh, you can use:

Ah, wait, this is editor scripting, right?

The problem you’re having right there, is you only have the class definition, you don’t have an instance. You can’t iterate over the components until you have an instance.

Thanks @ClockworkOcean for the reply…
Understood , Just wondering Is there any another route to do this functionality…

What are trying to do?

@ClockworkOcean …I have skeletal mesh components in Blueprint, i would like to set the static mesh for each component. I am trying to write an automated script to do so. The automated script job is when any blueprint is selected, the script should loop through all the components and set static mesh to it in the editor.

Normally we can get the components for actor and we can use setSaticMesh function, but problem here is its in the editor and cannot create object for the blueprint actor

If there is an instance in the level, you can set its meshes, but not for the generic class of the blueprint.

Got it. Do you think, is there any work around to make this happen… I have to set manually otherwise for 73 components… everytime

Unless I’ve got this wrong, you’re basically making a new class, in editor. Pretty sure that can’t be done in blueprint. Probably can in C++.

I have Blueprint A contains 73 components and I have to set static mesh for all the components.

I would like to create a blueprint lets say Blueprint B , with functionality – when i select Blueprint A and apply Blueprint B function to perform through scripted actions, it has to Blueprint B has to set the static meshes.

I have attached an image showing the scripted actions

Yes, I get it. If your BP is in the level (A), you can do this, if it’s in the browser (B), you can’t, without C++

[ I could be wrong / missing something, but I don’t think so ]

I see How to approach if I place my Blueprint A in content browser? Any quick suggestion for that in C++…
I now think that, I can place in level and apply the scripted actions … Thanks I will try this route, Appreciate your answers

1 Like

If you’re working with the editor source, you can make it do anything, basically. Putting it in the level is very much the easier way :slight_smile: