Problems with referencing/casting to 'My PlayerController'

Hi!

So right now i’m trying to create a weapon that shoots a linetrace to see what it hits, and then measures the distance to the hit and uses that to spawn a projectile and give the projectile a accurate life span so it destroys itself just when it has reached the ‘hit’.

Everything works great so far except that i need to bring the vector length from the ‘MyPlayerController’ BP over to the Bullets Construction script so that every time a bullet fires it gets a new Life span from the ‘MyPlayerController’ BP… and i just cant figure out how to bring that variable over.

I will admit that i haven’t fully understood everything around referencing blueprints and casting, but so far i’ve managed to just brute force it to work through trial and error, but i cant seem to get it to work this time.

So here is where the variable gets stored (Right now just the vector length as ‘Handgun Bullet Lifespan’) :


Then i tried creating a BP reference in my Bullet BP and get the variable from there:


But that only returned ‘0’:


And now im trying to instead cast to ‘My PlayerController’ but im failing miserably and dont really know why:


Any help would be much appreciated!

It’s possibly due to fact that not everything is accessible in construction script, try using Begin Play event insted

Yay! That worked!

Is there any downside to using ‘Begin Play’ in the Event Graph instead of the Construction Script?

Thanks a lot!