I want many blueprints of same parent class but with different static meshes (SM_Cube, SM_Ramp etc) inside so that i can reference them all with a getallactorsofclass() and change all their materials at the same time in a loop. How is this done?
First of all, welcome to UE forums. To do what you would like to do, you should first create a parent class:
And then create a child of that parent:
Then inside your Parent class, assign a static mesh:
Be sure that “Editable when Inherited” is ticked (it is by default). Go ahead and select the static mesh to be whatever you want in the parent. Then, create a function/event in the parent class - something like this:
Next, in the child, select the static mesh component and switch it to something else:
Now, in any other blueprint (I’ll use ThirdPersonCharacterBP), call GetAllActorsOfClass. Then loop thru the array, and call the function we created: