I want to spawn target points but cant do this with SpawnActor method, How can i do this ?
why can’t you use SpawnActorFromClass?
Try creating an actor (for example: BP_Actor). In BP_Actor create variable integer. This variable may be required to distinguish several such BP_Actor, if you have a lot of them. When an BP_Actor is spawned, write a new value to its variable.
What is the issue with using SpawnActor?
I typically set-up a FTransform or FVector location variable then use SpawnActor followed by SetActorTransform or SetActorLocation.
…as a follow up, if you look at Actor.h, it has the following signatures available too:
/**
* Spawn Actors with given transform and SpawnParameters
*
* @param Class Class to Spawn
* @param Location Location To Spawn
* @param Rotation Rotation To Spawn
* @param SpawnParameters Spawn Parameters
*
* @return Actor that just spawned
*/
AActor* SpawnActor( UClass* InClass, FVector const* Location=NULL, FRotator const* Rotation=NULL, const FActorSpawnParameters& SpawnParameters = FActorSpawnParameters() );
/**
* Spawn Actors with given transform and SpawnParameters
*
* @param Class Class to Spawn
* @param Transform World Transform to spawn on
* @param SpawnParameters Spawn Parameters
*
* @return Actor that just spawned
*/
AActor* SpawnActor( UClass* Class, FTransform const* Transform, const FActorSpawnParameters& SpawnParameters = FActorSpawnParameters());
Let me know if I have misunderstood your question.