How to get access to some variable of blueprint which is a part of another blueprint?

I have a flashlight blueprint that contains a light source with an intensity variable. I added the flashlight blueprint to the first-person character by dragging the flashlight blueprint into the character blueprint viewport.

The flashlight blueprint follows this scheme (with auto receive input set to player 0).

While the flashlight dragged into the world reacts to button presses, the flashlight on the character does not.

So, I think I should manipulate the character’s flashlight directly. To do this, I need to somehow get access to the character’s flashlight intensity in the character blueprint. How can I achieve this, or is there another solution?"

It appears you are halfway there!

To add the flashlight to a character in Unreal Engine, you can follow these steps:

  1. Create an Actor Component for Flashlight Control:
  • Create a new Blueprint class based on ActorComponent. Let’s call it FlashlightComponent.
  • Add a variable to store the Flashlight Actor.
  1. Attach Flashlight to Character Blueprint:
  • Open your Character Blueprint.
  • Add a new component of type FlashlightComponent to your character.
  • In the Construction Script or Begin Play event of the Character Blueprint, spawn the Flashlight Actor and set it as the FlashlightComponent’s Flashlight Actor variable.
  1. Control Flashlight State:
  • Add input events in your Character Blueprint to toggle the flashlight on/off.
  • In response to these input events, call functions in your FlashlightComponent to turn the flashlight on/off.

Thanks for the answers, but I found an acceptable solution in this video:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.