Setting actor properties pre-spawn
Hey all, I want to spawn an Actor with some default values set before the constructor is run.
In Unity/C# I would create the object and set values before spawning it into the scene, something like:
Can anyone educate me on the best way to do this? I think I need something like custom spawn parameters but I'm having trouble figuring this out.
It seems quite simple to do in blueprints as I've seen here: https://www.youtube.com/watch?v=Qv6pTOVcVDA
Any help would be greatly appreciated. Hopefully this isn't a stupid question but I'm sure there's an obvious answer that my brain cant figure out right now. C++ in UE4 is still quite new to me and translating what I can do in blueprints to C++ can be tricky.
Override PostInitializeComponents() and set your transforms there. This is post-constructor of course.
If this is not what you are after you can use GetWorld()->SpawnActor, you can specify spawn parameters here and an optional template AActor as well as other useful things
Follow this question
Once you sign in you will be able to subscribe for any updates here