Can someone please show me a 5-10 step tutorial for spawning an actor properly according to standard Unreal Engine methodology? Are actors supposed to be spawned from player controller, character or actor?
Is there a ten minute tutorial on youtube that shows you how to spawn an actor at FVector (0,0,0) when a key is pressed?
I have a twitch video showing me and twenty other people trying to figure this out, it’s extremely difficult. I’m so tired.
My background is Unity & C#. In Unity, spawning an actor from C# code was a trivial task. Don’t get me wrong, Unreal Engine is BEAUTIFUL, but it’s just hard to use.
void AriseCPPPlayerController::OnPlaceObjectPressed()
{
//F KEY PRESS WORKS
GEngine->AddOnScreenDebugMessage(-1, 5.0f, FColor::Red, ("At least the F key press works! Now let's spawn an actor."));
FActorSpawnParameters SpawnInfo;
FRotator myRot(0, 0, 0);
FVector myLoc(0, 0, 100);
//just spawn the god **** actor
AmySphere mySphere = GetWorld()->SpawnActor<AmySphere>(this->GetClass(), myLoc, myRot, SpawnInfo);
//AActor* MySpawnedActor = World->SpawnActor<AmyWallSegmentCPP>(myWallSegmentClass, SpawnLocation, SpawnRotation);
//AmyWallSegmentCPP* const SpawnedPickup = World->SpawnActor<AmyWallSegmentCPP>(myWallSegmentClass, SpawnLocation, SpawnRotation, SpawnParams);
}
How would I get the above code to work at the most basic level of Unreal Engine C++? Let’s say from a keypress triggered from player controller.
I’m trying, I really am, I’m so tired.
**cpp**
#include "myObject.h"
.....
AmyObject* myObject = World->SpawnActor<AmyObject>(BlueprintVar, SpawnLocation, SpawnRotation);
**h**
UPROPERTY(EditDefaultsOnly, Category=Projectile)
TSubclassOf<class AmyObject> BlueprintVar;
I made a BP of myObject too.
Can someone please provide step by step or youtube video? Need sleep.