Can't change colour of rect light but point light works fine!

Hello again!

I have this simple transition I’m doing to change the colour of my lights.
This code works perfectly if the lights are point lights. But if they are rect lights (as I need them to be), it doesn’t work.

If I change the lights directly without the animation, it does work.

Also, as you can see, I’m also changing a scalar value to start a shader effect - and that works just fine!

So this makes me believe it’s not about the timeline, or anything like that.
It’s only the rect lights that don’t work properly!

Is this an UE5 bug?
Or is there another way of doing this for rect lights?

Really appreciate any help or advice!

Thanks!

Hello friend!

Loops run between frames so running a timeline in a loop wouldnt work.
You could instead use something similar to this:


You can use a timeline to still change the color as you wish to.

Just open the timeline and select color:

Hey @Vinicius_Pires, thanks for the reply!

However, since this works for me both with point lights and with the scalar parameter I’m changing for the shader, I don’t think it’s true that you can’t run timelines inside the iteration of a loop, as I’m doing so successfully repeatedly.

The only thing that seems to break it is using rect lights.

Plus, I did try your suggestion and it didn’t work either. It works if I change the rect lights into point lights, though.

At this point I’m thinking I might as well use point lights then, although rect lights are more appropriate to my scenario (I’m lighting a small room from a ceiling lamp).

Unless anyone knows of a way to fix this (apparently) UE 5.4 bug?

1 Like

hi,I think it’s true.if you put a timeline in a loop it will begin the timeline agin and again.Until the loop is ended.then the timeline works for the last light in the array.

you could try something like this:

1 Like

Hello!

It was nothing, any help is already a Rec light in the right direction, right?

About loops and timelines. Well, as far as I know from having used a similar setup, loops run every frame, so every time they change the color of a rec light, it restarts the timeline to run another one right after. All of this very quickly.

What you could do is something like this to use your array of rec lights:

Edit: I just saw @baobao4435 answer It looks promising!

1 Like

@baobao4435 Your suggestion worked!

Interesting! I wonder why my original setup works for point lights but not rect lights. :thinking:

Anyway, I guess I learned something about how Unreal treats loops and timelines. Thanks! and also to @Vinicius_Pires ! :slightly_smiling_face:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.