Create light programatically

How can I create objects at runtime? I would like to be able to create a light (with a specified location and light color) at runtime.

How can I do this? It took me about 20 minutes with Unity3D, so I expect that it is not too tough with UE4, but just haven’'t found any information yet/

Thanks.

SpawnActor with the class of PointLight? Is that what you are looking for? We have plenty of documentation on this for both Blueprints and C++. Here’s the C++ intro docs

When I use SpawnActor to create lights from an actor, even if I’ve gone on to call AttachToActor(this), when I then delete the actor in the editor it promotes the light out of its hierarchy and leaves it on the map. So I don’t think it’s simply “SpawnActor with the class of…”, and I don’t think you have plenty of documentation on this. Where can I find correct and complete documentation on this?

Not to mention your docs aren’t even correct. E.g. the SpawnActor(class, owner) form that should be possible according to Spawning Actors in Unreal Engine | Unreal Engine 5.2 Documentation, instead attempts to call SpawnActor(UClass*, const FTransform&, const FActorSpawnParameters &) and fails to compile trying to pass owner through the FTransform parameter, but that form isn’t mentioned anywhere on that page. It’s buried in the API docs but don’t start a page of incorrect/missing info with an opener like “Unreal C++ Is Awesome”. :stuck_out_tongue:

I gave up on UE and moved over to Unity3D. I found UE4 not only very demanding on my system, but incredibly unintuitive and difficult to use. I have questions posted all over and none of them really get any response. I went through pages and pages of code, text and pictures but their were either plain wrong or outdated (another big problem - UE4 changes quickly and the changes are often breaking… several times after upgrading, my project would not compile). I also found the fact that they have wrapped everything in their own API extremely cumbersome… FString, TChar, FSocket… You cannot use regular c++ without running into a whole host of issues.