Accessing public bool in different BP
Please excuse me for asking so many questions.
I currently have:
My FirstPersonCharacter has a key input that toggles the light of the BP_Flashlight. My BP_Flashlight has a Sphere Collision so it can overlap enemies and attract them to the player.
My goal is to set the radius of that Sphere Collision to 0 when the flashlight is off, and to ~340 when the flashlight is toggled on.
My problem seems to be I either can't access the sphere from my FirstPersonCharacter, or I can't access the key press from my BP_Flashlight.
I tried to create a public toggle Bool that would be set in the FirstPersonCharacter, and below you can see in the BP_Flashlight I'm trying to access that bool, but I'm not doing it properly.
I also clumsily attempted to make some form of Interface to utilize another bool that I theorized I could access between the two BPs but it did not pan out.
The warning reads: "First Person Character does not inherit from Sphere Collision (Cast to FPCharacter would always fail).
Any help would be greatly appreciated.
asked Dec 24 '17 at 10:42 PM in Blueprint Scripting
I see you have added your BP_FlashLight as a component to FirstPersonCharacter. You can easily access any public variable that are defined in your BP_FlashLight from your FirstPersonCharacter blueprint as such:
Inside your FirstPersonCharacter Blueprint, on the left in the Components List, click and drag BP_FlashLight into your blueprint. Once it appears there as a variable, click and drag from its output pin and while the dragged line is still there released the click button and a list of options appears. Type the name of your boolean variable (In your case it seems to be FlashLightToggle) and you should be able to access it from there.
Hope this helps.
Follow this question
Once you sign in you will be able to subscribe for any updates here