Set Morp Target not working with for Each Loop and a Random Delay

I want to add a random blinking to all my actors within a for-each loop with setting a morph target animation and a random delay between each blink. The problem I have is that the animation only is applied to the first actor in the loop, instead of all of them. Any idea what is wrong with this blueprint?

The issue is that it’s only one timer and only one timeline, and calling them multiple times doesn’t start multiple timers or timelines.
I suggest making your skeletal meshes into blueprints, and handling blinking independently for each of them inside their own blueprints.

2 Likes

I think I understand what you are saying here, but forgive me to ask how to do this in a way I that I can easily create one single blueprint that then applies to all the actors. I am new to unreal engine, so any steps on how to do this would be helpful.

So my understanding of your reply is:

  1. Take one actor (Skeletal Mesh) from content library, right click and click Create Animation Blueprint???
  2. In that blueprint, create a single blinking animation with a random delay.
  3. Open another actor and assign the new blueprint (from step 2) to it. (How do I assign it??).

Some additional notes: I’ve imported all my actors from Daz3d, and they all use the Genesis8 base skeleton. (Not sure if that helps, or even provides a way to set the blinking animation to all of them at once). I actually tried to see if I can do it with genesis8 skeleton, but it appears that “Add new time-line” cannot be done in all blueprints. Also Set Morph Target is not always available so I had no Idea to where to put this code from my initial post. I just put it in BP_ThirdPersonCharacter as this was the only place I could find timelines and Morph Targets.

No, if you create separate blueprints for each skeletal mesh, it will be a mess and difficult to control.
As I understand, morph target “Eyes Closed” is the same for each skeletal mesh. So you just create a generic blueprint, and add a Skeletal Mesh Component. Create a function that will launch your timer and timeline for that Skeletal Mesh Component.
When you place this BP into the level, you can set any skeletal mesh to the Skeletal Mesh Component. And your functions will work independently for each Skeletal Mesh, because you place independent instances of your BP into the level.

2 Likes

I am really sorry, but since I am a noob I get already stuck in your first part. I am trying to create a generic blueprint, but I don’t know what you mean exactly by that. When I click on add Blue Print Class I need to choose one of the following:

(See next post to continue reading. Seems I can only paste one image per reply)

I tried various options here and I run in the same issue for all of them. Nevertheless to me an Actor Component looked logical, since I want to add that component to other actors. Anyway, when I do this, I get stuck like this:

  1. I added a variable for the skeletal mesh
  2. I create a new function to animate
  3. I am not able to fill that function, because the “Add Timeline” component is not available to add to this blueprint:

What am I missing here?

Create Actor Blueprint. Add Skeletal Mesh in components. Do what you need on BeginPlay of this Actor Blueprint.

As for why you can’t add timeline here, is because functions don’t allow latent nodes, and timeline is one of them. Do it in EventGraph.

2 Likes

Ok, I’ve added it now as an actor blueprint and created the code. I have simpliefied the code a little, just to use a delay instead:

Reading your other part of the reply I don’t know what you mean with: “When you place this BP into the level, you can set any skeletal mesh to the Skeletal Mesh Component. And your functions will work independently for each Skeletal Mesh, because you place independent instances of your BP into the level.”

I’ve placed the new BP into the level, however because I’ve imported the actors from Daz3d, they already have a skeletal mesh attached to them. So how can I ADD this extra blueprint to the actors on my level? I think I am almost there, but I don’t understand how to add another blueprint to the existings ones, since I cannot lose the existing Daz3d blueprints (I think).

Wait, so you already have blueprints? I have no idea what Daz3D is, but since you were getting All Skeletal Mesh Actors in the beginning, I assumed that you simply had skeletal meshes placed in the level.

1 Like

Daz3d is a modeler tool and I use this to generate actors to import them into unreal. So yes when importing an actor, it generates all kinds of object for me automatically. So what is does, it generates a SkeletalMesh with the skin, including standard morph targets. This Mesh also has a base skeleton called Genesis8BaseSkeleton (because all Daz3d characters are based on Genesis8, that all has the same bones and morphs available). That is also why I am able to generically use the morph called “Eyes Closed”, because all daz3d character export these morphs.

Btw, I was able to add the blueprint on the map and assign the Daz3d actor to the ActorToBlink parameter, and that made the actor appear on the map.

So I think I need to change my code to actually use the new blueprints instead of the normal skeletalmeshes I was placing onto my map. Is this a correct assumption? Or am I misunderstanding it completely?

I am marking this as the solution, since it actually helped me in figuring it out. By adding the newly creating blueprint to the world and setting the skeleton component to the Daz3d actor, it worked for all the actors. So I am now placing the blueprint actors on the level in this way, instead of just placing the skeletal mesh directly onto the map.

So thanks a lot for the replies!