How to get access to some variable of blueprint, which is a part of another blueprint
- Exposure: public
- UE Version: 5.3
ctrl + v
1 comment
-
There is no reason that a flashlight would need to know about the character, nor the character would need to know about the flashlight. They should be and are different blueprints, different actors in your game. They will need to have an interface to work between them.
Let's call the interface "BI_Interact". Make a function called "Interact" and make an Input parameter called "Intensity" as a float. Now, on the flashlight blueprint, you would implement the interface BI_Interact and implement the Interact event on to the graph. In the code for the Interact, you would alter the intensity of the light source from the Intensity parameter passed in through the function.
On the character, you would put the Interact message node (it has an envelope and says (Message) at the end) and attach the actor that you want to interact with. Put the Intensity amount into the Interact and you are all set.
Yggdrasil
February 5, 2024, 2:33 am