How do I replicate SpotLight Angles?

Hello everyone,

I’m sorry if this question seems stupid, quite new to Unreal and I can’t seem to get this figured out.

I’m trying to change the SpotLight inner and outer angles. Everything works fine When I run it as a Standalone, but not as a Client.

I’ve achieved multiple different replications so far, but I can’t seem to get this one working.

Even the most simple example won’t work, and I can’t figure out why. If you’d be so kind to help me, I’d greatly appreciate it.

PS: I’ve also already done some searching, but the best i could find is that the change of an attribute should be replicated normally.

Hey there @Magiermacht! Welcome to the community! Give this one a try. First is a server call, then to a multicast that sends that to all clients.

2022-09-29_00-29-50

1 Like

Thank you for your very kind and quick response @SupportiveEntity

I’ve managed to replicate your solution, and it works, very well. An attempt to implement it into my demo didn’t work. But I think I’ll figure it out from here.

Have a great day.

EDIT: yep, 5 minutes later and i could apply it properly.

I’ve come across another solution, but it feels kinda like a bad practice, i’ll stick with it for now though.

  1. Player actor is calling an interface function of the Light-Actor (inside a server event)
  2. This function sets a replicated variable, “target angle”.
  3. In the “Event Tick” I change the angle (without authority check) to the variable angle.

Why do I do it this way? Because I want to change the light gradually (See below)

  1. Player-Actor calling the “Set Cone Angle” after calculating the new degree:

2.1. Interface Function implementation

2.2. Event Tick

2.3 (not important for the topic at hand)

Result Video:

Start with tick disabled.

On event change angle enable tick then once the angle reaches the target angle turn off tick for performance.

Or just use a timeline in place of tick.

1 Like

Looks fine to me, moving off of tick as Raven suggested could definitely be an improvement however. Timelines could do the job and even with a little bit of flare if you wanted to make the curve look good.

1 Like