I am trying to Spawn an actor that has a satic mesh, I want to trasnfer a boolean before it the constructor is called to set the static mesh to a cube or a sphere. I do not know how to cope with this problem,
I have tried using SpawnActorDeferred and BeginDeferredActorSpawnFromClass, but they call the contructor before I can modify any value. I there something that I forgot?
I have tried these things:
//1
Layers[i].neurons.Add(Cast<AC_Neuron>(UGameplayStatics::BeginDeferredActorSpawnFromClass(this,NeuronClass, FTransform::Identity)));
/Layers[i].neurons[k]->FinishSpawning(FTransform(FRotator::ZeroRotator, end));
//2
Layers[i].neurons.Add(GetWorld()->SpawnActorDeferred<AC_Neuron>(NeuronClass, FTransform::Identity, nullptr, nullptr, ESpawnActorCollisionHandlingMethod::AlwaysSpawn));
UGameplayStatics::FinishSpawningActor(Layers[i].neurons[k], (FTransform(FRotator::ZeroRotator, end)));
Thank you