How come this does not work?

EventTick will trigger the CastToFirstPersonCharacter.
LMBwill not.

This is being done in a seaparate BP than the character BP because the light is in its own BP, being attached to the Character. In theory when the Character user presses LMB, shouldn’t the light change brightness?

The light starts on, but I cannot get it to turn off using the keyboard button LMB, from inside the light blueprint.

This cannot be done inside my Character BP.

Hello,

The reason this doesn’t work is because your blueprint isn’t set up to receive input. What you’ll want to do is set up a function in your blueprint that contains the Spot Light, and then use the Left Mouse Button event in your character blueprint to call the function of your Spot Light blueprint.

Here is a simple example I set up:

First, in your character blueprint, create a variable, and make the type whatever the name of your spot light blueprint is. For me, it was called TestActor. Check the Expose on Spawn box on your variable so that you can set it in the level.

Then, place an instance of your spot light blueprint in the level, select your character in the level, and look for the Default section in the details panel. In this section, you should see your variable that you’ve just created, along with a dropdown that allows you to set the reference. Go ahead and click the dropdown and select your spot light actor. This will set the default value for that variable to your spot light blueprint that you’ve just placed in the level.

Finally, set up a function in your spot light blueprint that performs the logic you would like, and then on the Left Mouse Button event in your character blueprint, get a reference to your spot light actor variable, and call your function.

Here is what the character blueprint looks like when it is all set up:

Feel free to let me know if there are any questions, or if this does not work for you.

I am not getting it to work.

Even with New Visibility checked for On and unchecked for Off, my light is not changing from on to off using the FlipFlop connected to a LMB.

Could it be my functions?
My light is attached to another component inside the BP. And I have a child actor of this BP in my Character BP, can I use this instead of the Reference BP Variable?

If so, this would be very useful for my other blueprints, but I am unsure of how this would be accomplished – to reference a component of a BP that is accessed thru child actor BP that is within my character bp i.e. a skeletal mesh or a light.

Could you describe exactly what the problem you are seeing is? With the setup I have shown above, I had it working properly in my project.

  • Did you ensure to set the exposed variable in the level?
  • What are the two different variables Spot Light and Light referring to?
  • Which blueprint are the screenshots from?

The reference variable is one of the better ways to set this up. Other than that, you could also spawn the spot light actor class using the Spawn Actor From Class node in your Character Blueprint, and then promote the return value of that node to a variable, which would then be your reference to the spot light.

Can I set this up using the child actor component in my character bp?
Return the light from the actor bp that the child actor component is copying in the details panel?
Like how could I get a skeletal mesh, a component, to animate when all I have is a child actor in my character bp?

Does anyone know? I feel like this is pretty important.

I have a character BP with a child actor.

This child actor houses the light that I wish to turn on and off.

If I go to the child actor’s blueprint: I can add a light there.
My problem is getting this light (added to a bp, accessed thru character bp using child actor) into the character bp event graph so that I can change its brightness or visibility. LMB does not work for me when using a reference variable. In the photo above, the top two nodes are in separate functions of the reference variable’s bp. The nodes below are inside the character bp. I would prefer to get the light component from the child actor component that is currently in my character bp, with access to the bp that holds the object, and attached to that object the light.

Sorry for the late reply, I did not see this post way up here!

I am also trying to receive a collision box that is in a bp, referenced by child actor bp (inside my character bp). How can I utilize the box collision in character bp for that bp, using child actor?

You say the reference variable does not work for you. Did you ensure to set it to Expose on Spawn and then set it in the level, as show in the image below:

Yes I had to make it editable. But the problem is I have child actors instead of variables so I’m wondering why UE4 does not have the ability to get the child actor components, to do so with what I please.

The best way to set this up is to use the exposed reference variable. Child Actor Components are meant to be attached to a blueprint and then run functionality contained within that blueprint. They are not ideal for blueprint communication.

Using the exposed reference variable is the way to go for this functionality, unless you’d rather have it set up in the level blueprint.

Just for some ideas, here is a link to the blueprint communication documentation. It might give you some ideas on how you’d like to set this up.

Have a great day

Also, just for reference, I’ve set up another way to do what you’re trying to accomplish. This is all in the character blueprint. I’ve gotten all actors of the Test Actor class (which has my spot light) and for each, I call the set brightness function:

Is it possible to get a component of that actor class? Coming from the array?

It definitely is. Just drag off of the Array Element pin on the ForEachLoop and type in Get Spot Light, or whatever component you’d like to get.

This was definitely the solution. I wasn’t thinking that the element was where the information could be branched of, as opposed to straight from the outActors. I needed this for my character bp, i really appreciate the help!