Download

how to cast to custom class from Get Child Component ?

hello, i’m working on my game weapon system, i’m attaching my weapon when i pickup it, i spawn the blueprint class at 0,0,0 with 0,0,0 rot, then attach it to the socket of my player, that is working just fine.

my problem is that i don’t want to track the bullets count on the player i want to track the bullets on the weapon blueprint, i can access the attached component on the player using Get Child Component, but i can’t cast (or i don’t know how) it to my custom weapon blueprint to access it’s variables and properties.

ay one can help me with this, any help or tip will be very usefull.

thanks in advance for the help.

Hey Daimaku,

You will want to take the return value of the Spawn Actor and promote it to a variable. You can then use that variable to reference your weapon that was spawned. You can then do a Get of that variable and be able to get the information from the weapon directly through that. Let me know if that helps.

hi Alexander, i will try that, thanks for your help.