Download

How to get the actors spawned by level sequencer?

Hello,

I am creating a level sequence player which plays a level sequence which has “spawnables” in it. How do I get references to all these actors which are spawned by this player?

Thank you,

Thilo

Use the GetAllActorsOfClass node :slight_smile:

This is not a good method since a) I don’t know which level sequence player has spawned the object and b) it could be slow if the level has many actors. Also the level sequence player may spawn new objects later, so I would have to GetAllActorsOfClass in a timer or even in the tick event. I just want to set material parameters of all objects which are spawned while the level sequence is playing…

Call an Event with the Sequencer and spawn your Actors inside… in the same events, add the new spawned actor to an array of your choice… So you can iterate over the Actor array, that only contains your spanwed Actors.

Then I had to bind all the manually spawned actors to the level sequence. Did not try it, but may be much work. Also then I had to use empty actors in the level sequence editor and would’nt see, what I am actually doing…

The class “ULevelSequencePlayer” has an event “OnObjectSpawned” inherited from it’s base class, but it is sadly not a delegate so that I cannot bind it in blueprints. Well, I tried to make a new class inheriting from ULevelSequencePlayer to fix that, but because of the strange initialization procedure of the LevelSequencePlayer this will not work: You have to make a level sequence player by calling the blueprint-callable function “CreateLevelSequencePlayer” which spawns another class, and this class spawns a NEW ULevelSequencePlayer and returns it which will be the level sequence player which is actually used for playing the level sequence. So I would have to change this other class, too. And maybe more other classes, too… Just to get this “OnObjectSpawned” event blueprint-bindable. Much work and I even don’t know if it’s actually working or if they did not implement it on purpose since it’s not used anyway (the base class implementation of “OnObjectSpawned” is: {}). I will make a new thread for this in the C++ section.

I’d like to know this too - on the sequence player object (made by the “create level sequence player” node) there is “get bound objects” and “get bindings” but I can’t get anything useful with them. I have a recorded sequence and I need references to the components it spawns so I can get their positions (without confusing them with other components).

I feel there must be a way (maybe @Max.Chen knows), but in the mean time I think I have a fairly bad workaround that works for my case @ThiloN1987 :

Sequencer-spawned actors get given the tag “SequencerActor”. So you can “get all actors of class with tag” and find them that way. And then you have to find a way to identify whether it’s the one you’re looking for (if you have multiple sequencer things that can play in the world). In my case I tagged the components before recording the sequence with Take Recorder - when sequencer spawns it’s components, it seems to apply any tags they had when they got recorded - so I see if one of the components matches my known tag and then I know it’s the right one.

Here’s a solution that can work for actors that you tag. So, for spawnables, you could tag them all with the same named tag. Or if there are certain bindings you’re looking for, you can tag those with a specific named tag.