Altering all instances of a class

Hi,

I am quite frustrated over a seemingly simple problem:

I have created a class blueprint for a lamp (two lights coupled with a lamp model), and have around 20 instances of the said class in a level. I am trying to toggle visibility of the light objects with a single keystroke at the same time in all the class instances in the level.

Seemed simple enough, so I took a keystroke event node, and plugged it into the visibility of the light sources inside the class blueprint, but that does not appear to work. Only single instance will sometimes work as intended.

21562-wontwork.png

(this setup is the one that does not work)

Also having the keystroke node in the class blueprint disables the same node in the level blueprint as well. It works only if it is used once in all of the blueprints.

I had an idea to control the light though a variable, that could be referenced across both the level blueprint editor and class blueprint editor, but I don’t think there are global variables available.

TL;DR: I can’t figure out how to turn all the lights off with a single keystroke. Help.

I hope this makes any sense.

Thanks!

I’m having this same issue, instead with an actor blueprint that contains a static mesh. I have it set to animate when I press the “F” key using a timeline node. Everything works great, but when I duplicate the blueprint in my scene only the most recent one will animate with the key stroke.

I never managed to solve this issue completely, but I managed to get it work, here’s how:
I created a custom event inside the class, that does the same things that a keypress event would do.

23041-class_event_graph.png

And then I plugged in all the instances of the class in the level blueprint to the custom event, like in the picture below.

23042-level_blueprint.png

It works, but there must be a better solution.

If you really want ALL PointLights in your Level (or every other Class), have you tried using the “Get All Actors of Class” node? It returns an Array of actors that can be used with a For Each loop to change the Visibilty of every Actor inside it:

http://puu.sh/dhSix/15312b7ec8.png

It appears that this would work in this case, yes, but what about the problem which causes the only the most recent instance of a class to respond to keypress events?

Uh, this can be a side effect of your Setup. I would need to do some debugging for that. :X Can’t help you with this question.

Were you ever able to figure out a more elegant solution for this? I am trying to do pretty much the same thing. The custom event won’t accept inputs from Get All Actors of Class or anything else prescribed above.
It seems pretty silly to have to connect 50 nodes, when you have made a Class!

Unfortunately not. Just remembering this problem triggered me into a traumatic Vietnam War-like flashback.

If you find the solution somehow, please share it here too, as I will never find peace until this is solved properly.

Perhaps I am misunderstanding your issues.
But if you select the node that represents the keystroke, you can disable the consuming of that event.

Also, if your actor is not attached to your controller, by default you will not funnel input to it.

Here is an example where I have implemented a simple Event Dispatcher titled TriggerWalkway

Pressing U in my scene all the blueprints associated execute.
Note the begin play where I enable input from a given controller.