Ah yes, casting. Nobody seems to be able to explain casting properly. I even did a video on that topic but it’s long so i’m just gonna make a simple explanation here.
The biggest issue with understanding casting by new “scripters” is seeing a difference between blueprint class and blueprint instance. When you create a blueprint and it’s in the content browser it’s a blueprint class. When you put it in the world, that object is a blueprint instance. You generally access the class to get class defaults (variables you set in the blueprint editor) or want to spawn an instance. You access the instance to get info about that specific instance.
So, how do you cast to a blueprint instance (this would be for example a ball you placed in the world and want it to move a little bit in a random direction whenever you press E key).
Let’s say you already placed that ball and you’re in the first player example map and have everything set.
You need a way of interacting with that ball to check it’s properties. Easiest way is ofc getting all actors of class (which you already know), but it’s bad because you can have a very large number of those in the world and you don’t need to check that many so this will hurt your performance for no reason.
First real example way is getting all overlapping actors and on event overlap where you get that reference similar to get all actors of class.
Second example is a line trace. Check on yt how to do it. You generally cast it from player’s camera and it get’s a reference to whatever it hits (my personal favourite).
If you’ll get through line trace tutorial you’re very likely to catch up from that point.