Understanding Blueprint Casting

Hi, I have been recently experimenting in making VR mini games. with many accomplished goals, I can not seem to figure this one out. I have built a simple mini-game where a player needs to destroy large red blocks that follow the pawn with smaller yellow blocks. For my Scoring System, I tried to make the yellow block cast to another actor that handles scoring but the cast always fails.I am pretty sure that parent actor is the wrong thing to do.

Well the obvious answer is that the parent actor of the pickup cube is not a ScoreMain. This could be because the parent actor is invalid or because it is of another type. This isn’t really a problem with casting because if you had the correct reference to your ScoreMain actor then it would work just fine. The problem is that you’re not getting a reference to the ScoreMain actor correctly. There are many different ways to get a reference to another actor, if your PickupCube is placed in the level then you can simply create an editable variable of a reference to a ScoreMain actor and then set it in the level. If your PickupCubes are spawned in the level then I would either set a reference to the ScoreMain actor when they’re spawned by setting “Expose on Spawn” to true on that variable then setting from the spawning actor, or by getting a reference to the ScoreMain actor within the PickupCube.

Thank you!!! Everything works now!

Great! Please mark the answer as accepted so others can see that the issue is resolved.