I’m sure this is probably an easy question to answer but I just can’t seem to figure it out
So I have a point light and I created a custom event called “TurnON” that upon called would toggle the visibility of a point light.
and I have box collision that upon overlap should call the custom event “TurnON” and thus toggle the visibility of the point light.
However, when my character overlaps the box collision, the overlap node fires but doesn’t seem to affect “TurnON”. I know the box collision works because I tested it by using it to move other objects.
I understand there are many ways to toggle a light but I’m interested in learning why this doesn’t work.
While an Integer Variable, or a Float, Boolean or whatever, have a Value right when creating them (Integer = 0, Float = 0.0, Boolean = false)
a REFERENCE Variable (that’s the blue one are using) is empty. Like really empty. There is nothing in it. It’s a container.
You have a “PointTurnOn” Blueprint and a “Switch” Blueprint. Now you have a REFERENCE Variable of Type “PointTurnOn” in your Switch.
BUT it’s empty by default. There is nothing saved in it. Selecting “PointTurnOn”, only means that this is the type of Actor you can save in it.
You need a Reference to an actual Instance of the “PointTurnOn” Blueprint.
Why? Well, the Blueprint, as the name says, defines how the “PointTurnOn” will work etc. But you can spawn a lot of them into the Level.
Now how should the Reference variable in “Switch” know which one you mean, without you telling him? Right, it CAN’T!
There are multiple ways to get references to specific Actors in the scene. Let’s assume you have both placed in the Level. Both are now a specific
instance. You could place another 2 and they would also be unique instances. Now, and you already done that, you can set the “PointTurnOn” Variable to
be “Editable” (in the Switch Blueprint). This means, you can edit it when it’s placed in the Level.
So if you now select the Switch you placed in the Level, you will find that Variable in the Options Tab, where you also define the Position, Scale etc.
Now, when you have a “PointTurnOn” (or multiple) placed in your level, you will find them in the DropDown. BUT they need to be placed in the Level.
Reference Variable NEED to be filled with an actual spawned instance of an Actor. This is a fundamental thing you need to understand.
Don’t if this will help but when you toggle the visibility it only sets if you can actually see the light. It doesn’t turn the light on. Make sure auto activation is turned on and visibility turned off by default. I have struggled a few times with a problem like this only to find two settings contradicting each other haha. Sometimes we over complicate the problem.