I have “dragged” in a TargetPoint actor into my scene so it would be exactly where I want it.
Now I need to access it’s world location in my gameMode class so I can spawn an enemy class I have created to that location.
What I don’t know is how to get that information for anything not created in code, making spawning a bit tricky.
I am doing this so I can get all of my game logic done in C++ otherwise I would already have tried it in BP.
If you know of a really nice code tutorial for spawning enemies through C++ or I am just going about it wrong please let me know…
- Try using this if you stay with spawning in blueprint. This isn’t the preferred method but it’ll work.
TArray Actors;
UGameplayStatics::GetAllActorsOfClass(GetWorld(), ATargetPoint::StaticClass(), Actors);
If you have multiple target point then you’ll need to identify it from the others with a tag or some other variable.
- Here are some examples/documents for spawning an Actor in C++:
Essentially you’ll end up with something like this: