Set actor / component lighting properties at runtime.

Lighting.jpg

What I want is to set Lighting Channels in game dynamically. Why all the lighting properties can’t be changed during runtime? Is there a good reason for that? As it comes to lighting channels I can’t think of a reason, same for “Cast Dynamic Shadow”, or “Self Shadow”, “Shadow Two Sided”…

So, next question, is it possible to write functions in C++ for that not changing the source code of the engine. Like, a plugin?

Never mind, got that, I guess.


void UTiExtendedLibrary::SetLightingChannels(UPrimitiveComponent * Component, bool Channel0, bool Channel1, bool Channel2)
{
	FLightingChannels Channels;

	Channels.bChannel0 = Channel0;
	Channels.bChannel1 = Channel1;
	Channels.bChannel2 = Channel2;

	Component->LightingChannels = Channels;
	Component->MarkRenderStateDirty();
}

Truth is, that function could be added, along with others. Might consider writing some library for that later…

For posterity: 4.25 has a built in blueprint method: https://forums.unrealengine.com/deve…able-variables