How do you reference a spawnable actor from a sequence?

I’m trying to reference a spawnable actor from a sequence because this actor is a spawned version of my player character and I want it to use the same mesh and material that the player character currently has. However I’ve found no good way of being able to reference the actor in the level blueprint. Does anyone know the best way to do this? Or the best way to do what I’m trying to accomplish?

hi @bufkus ,
if your character is already spawned into the map and you want to play animations on it, you should use a Binding and assign your player character dynamicly to the sequencer track holding the animation for your character.

1 Like

Hi, I tried to follow that guide, but it doesn’t work for actors that are spawned within a sequence.

Well in case anyone else has this problem, I figured out an easy solution:

  1. Create an event trigger under the spawned actor in the sequence.
  2. Make sure to pass the actor as the target/parameter in the event settings.
  3. In the sequence event for the actor, do the change mesh logic. No need to touch level blueprint.

It was a lot easier than I expected after struggling to find a solution for weeks.

Just a warning that the whole find actors by tag/class does not work with spawned actors in a sequence.

You can get a reference to the character(s) in the sequence by doing the following:


You will need the “Sequencer Scripting” plugin enabled to use these nodes. You will also need a reference to your Level Sequence Actor or Level Sequence Object in order to access the “Get Bindings” node, and you will need a Level Sequence Player ref. This code loops through every object in the sequence and tries to cast to Character, so if your player is the only character in the sequence, it will return that. You may need to do a check if you have more than one character in the sequence to determine who is who. You could also cast to something like Cine Camera Actor instead if you wanted to access the sequencer camera.

3 Likes

Is it possible to show this solution?

So probably a little late to the party here, but i found very little information on how to get this working correctly. But i have managed to now have random pawns in the world become possessed by the sequence once it begins by doing the following:

  • Add a pawn to the world of the same pawn type or subclass of the type you are spawning
  • Create a new track with this pawn
  • Add tags to this track (right click the track > Tags > Add tag name at the bottom

Now to bind the newly spawned Pawns, I do this in c++ so when i spawn my pawn through my own code i do this (Pawn is the newly spawned actor):

// Get the binding for the track tied to the "SpecialGuest" (we have set this track up and then deleted the possesable character from the sequence so we replace an empty track)
	
FMovieSceneObjectBindingID NewBindingID;
NewBindingID.SetGuid(LevelSequence->FindBindingByTag(TagSequenceSpecialGuest).GetGuid());
	
// Set the newly spawned Special Guest to use this binding
SpecialGuestStageSequence->SetBinding(NewBindingID, { Pawn });
	
	
// Play the sequence
LSPlayer->Play();

So this essentially gets the track to be bound to our newly spawned pawn via the tag and then we set our newly spawned pawn to be the bound to that track.
Now in your sequence you can call all sorts of things on this character via events etc

In mine i deleted the actor the track was bound to (they were possessable) hence the text is red in the image, this just meant i wouldn’t see this random pawn stood around. I did have some issue with deleting this pawn and found i needed to exit the editor restart it then find the pawn in the world outliner and delete from there, otherwise it seems to delete the track from the sequence if you delete the pawn any other way. You’ll know it’s not deleting the track from the sequence because when it works correctly you’ll get an unreal prompt saying you are deleting something that has references.

I imagine you might be able to use the spawnable setup on the pawn instead of posseable, but i tried this out in a packaged build and it all worked. It’s a little buggy on unreal 4.27 which is the version i am using.