Pass parameter to constructor somehow?
I have a problem with the Constructor Helpers. I MUST create the UTexture and UMaterialInterface inside the constructor. But the UTexture must be set through a variable. So how can I set this variable prior to construction? I tried BeginDeferredActorSpawnFromClass() but that didn't help at all. SpawnActorDeferred() also did not work. It seems that those only work for Blueprint constructors but not for the C++ ones.
Please tell me there is a way to do this without me having to initialize ALL possible textures in the actor. I also tried a static TArray as a workaround but the moment I used it I get a LNK1120.
The actor that I'm trying to spawn:
I solved it the static way. It seemed the best solution given the limitations while also being forced to do it inside the constructor.
Now they all share the same materials while still having different material instances and without having to dump a variable to the constructor.
Note that the UTexture and UMaterial MUST be created in the constructor but the UMaterialInstanceDynamic MUST be created after BeginPlay() was called while also not being able to use parameters in the constructor in c++.
Follow this question
Once you sign in you will be able to subscribe for any updates here