How to access custom event of dynamic object stored in an array

Hi. I am using UE4.16.3.

I would like to ask for help how to access my custom event of dynamic objects placed in an array.
I have spent quite a lot of time to get it work but I can not find the right solution.
The approach I would like to achieve is to work directly on the objects placed in the array, not on a new copies.

I am following this tutorial (Fun with Blueprints : Spawning Dynamic Objects): https://www.youtube.com/watch?v=9-7SmkasS_A

I like a lot the solution showed there but it was created in older version of the UE.

Everything is working for me to the moment when I try to access my custom event of dynamic object stored in the array. (Video time: 25m19’).

Generally there are used two main blueprints for it:

  1. DynamicCow - used a an object dynamicaly spawn and stored in the array.
    The DynamicCow blueprint has custom event “DestroyThisTowCow” and the event is used in the Event Graph of this blueprint.

  2. SpawnVolume - the blueprint, in the “EventGraph”, spawns the “DynamicCow” objects, stores them in the array and
    at the end iterates by all “DynamicCow” objects stored in the array calling on each “DestroyThisToyCow” custom event.

On the video is shown available to choose/use option “Call Function For Each->Destroy This Toy Cow”.
In the current engine version I don’t see that option.

I have try to use “Array->ForEachLoop” but it doesn’t give me the access to my custom event created for “Dynamic Cow”.

I try to cast the object returned by “ForEachLoop”.

One approach - casting into “Class”, the second into “Reference” (Like on the screenshots).

In my case the “DynamicCow” blueprint I have named “MyDynamicObject”
and custom event “DynamicCow->Destroy This Toy Cow” I have named “MyDynamicObject->Destroy This Dynamic Object”.

For both “casting situations” I am getting error. I have try to solve the error but can not get around it.

Could someone please help me to solve the problem?

It looks like I have found solution for my problem. Instead of creating the array of classes like suggests the tutorial now I created the array of references to dynamically spawned objects and I can use “ForEachLoop” instance to get access to my custom event. Done :slight_smile: