Actor Casting Problem

To do this you need to understand what a cast does.

A cast will not create an or find anything. It’s part of the inheritance principle. Basically it’s like asking your friend if one of his parents was tall. He can answer yes or no. But you have to ask your friend. If you just ask a wall it won’t answer.

Right now you try to cast a variable from the type you want to itself. This won’t do anything in the first place since you already have the correct type. Casting from something to itself will not change anything. It’s purely to get a child of that actor or check if a specific belongs to that type. But even more importantly you just provide a variable.

It’s a bit like a bucket. You want to check if there is water in it, mud, lava or just nothing. You have a note telling you where the bucket is but you didn’t write anything on that note so all you have is an empty piece of paper.

That’s your newly created variable. It doesn’t contain anything and you can therefore not work with it.

As suggested you could try using “Get All Actors of Class” to get an array containing the objects you are looking for. Those will already be of the type you tried to cast to so it won’t be necessary to cast them again. You can also get objects via overlap events, saving them when you spawn them (since every spawn event provides a reference to the newly created ) or get them from a hit result (which you can get from traces or when your character collides with something).

I hope this helps.

Cheers