I have created a Class Blueprint of which is a projectile. I want this projectile’s mesh to be a random mesh on spawn from a selection of meshes. I have achieved this in the Level Blueprint, but need it in the Class Blueprint. I need it in the Class Blueprint so I am able to easily change the properties of the projectile without having to create a Class Blueprint of every single possible mesh (and then in turn needing to change the projectile properties, such as velocity, of every single Class Blueprint during prototyping).
I have attached screenshots to show you where I am at. In my screenshots I show only two possible meshes for simplicity sake. I have many more than this which is why I am asking this question (far too time consuming to change every single Class Blueprint velocities). The issue I am having is that I can not reference it’s own mesh when I use SetStaticMesh. I appreciate your help in advance:
This is what I want my final Level Blueprint to look like (spawn in the single Class Blueprint Projectile, that randomized it’s static mesh in it’s Class Blueprint): http://i.imgur.com/Gj80QsA.jpg
After MANY hours I have found a solution in case anyone else needs help with this matter.
You can leave the Class Blueprint Event Graph empty. In the Level Blueprint you will simply spawn the Class Blueprint and then change it into a static mesh. Here is a picture of what that looks like:
As you can see, I spawn in the Class Blueprint (which is a projectile) and then I change it’s mesh (it keeps its projectile properties) and everything works wonderfully.
You have to add an addition mesh and set the Root mesh to NONE, no collision. Basically make it non existent.
in the Class Blueprint picture you can see that I am setting the StaticMesh2 in the graph and not StaticMesh1.
I am a bit confused as to what you are trying to accomplish with the level blueprints. To make a projectile, you should create an individual blueprint for the projectile, and spawn it through your character. If you want to create multiple static meshes that are similar in size, you can set the static mesh to randomly choose from an array of meshes in the projectile blueprint. If you want to create meshes that are varying sizes/shapes, a good way is to create a parent projectile and then create child projectiles that call the same basic functionality. Then you can use an array of child actors in the blueprint that is firing the projectile to spawn a random selection from those blueprints.