Issues creating a light using IES file dinamically

I’ve made a light with a plugin inside the editor nothing too fancy

APointLight* MLight = World->SpawnActor<APointLight>(FVector(0, 0, 300), MActorRotation, SpawnInfo);
...
ULightComponent* LightComponent = Cast<ULightComponent>(MLight->GetLightComponent());
...
blablabla

I’ve tried to add an ies to it with (the .ies file was already loaded ok)

UObject *lpobj = StaticLoadObject(UTextureLightProfile::StaticClass(), NULL, *(lpname));
LightComponent->SetIESTexture(Cast<UTextureLightProfile>(lpobj));

But it didn’t work.

Even more tricky is the second case, I can create it as stacionary but the icon looks disabled (red cross on the viewport).

If I transform it adter creation to static in code the icon looks ok but I need to change a parameter (whatever under light tab) to make it working on the viewport.