I am trying to set up a button in my unreal game to make it so when its pressed it calls the function in the directional light to change it to night time for a set duration but for some reason its not working
I added an is valid to it and it says it is not valid but I have no clue how to fix itGet the line out of “out actors” and type get a copy(index 0). This is the reference to the first “sun” actor in the level. Insert the line going out of “get a copy” to starlight.
First of all, I wouldn’t recommend using get all actors of class unless you absolutely have to as it has a high performance cost. It is generally better to use a manager class to pass the sun over or set it at the beginning and not per click.
If you must however, unless you have multiple lights, you should use “get actor of class”, not “get all actors of class”. The reason your code doesn’t work is because you never set the sun variable to anything.
When you call get all actors, the pin, “out actors” is where they are, you need to grab them from there. If you use “get actor of class” instead, you will only have a single actor in the output instead of an array of them and you can connect it directly to the startnight function.

