Hey! So I’ve programmed a simple little pawn subclass, let’s call it TestPawn! It’s basically the default implementation that the editor generates when you create a new class that extends Pawn, with two added components, like this (skipping the default Pawn header stuff):
UPROPERTY()
class UPrimitiveComponent * Collider;
UPROPERTY()
class UHealth * Health;
Here’s the constructor:
ATestPawn::ATestPawn()
{
PrimaryActorTick.bCanEverTick = true;
Collider = CreateDefaultSubobject<USphereComponent>(TEXT("SphereCollider"));
RootComponent = Collider;
Health = CreateDefaultSubobject<UHealth>(TEXT("Health"));
}
Seems simple enough! But it’s acting weird!
Normally, when I drag and drop any Actor from my content browser into the scene view, the actor will be places more-or-less right where my mouse cursor is when I release the mouse button. However, when I drag my TestPawn into the scene view and release my mouse button it pops over to a strange seemingly random place in the viewport, nowhere near my cursor usually!
I guess it’s not a game-breaker or anything, but It’s pretty annoying and I’m really confused why my custom Pawn is acting different than other default Actors! Any ideas why this is happening? Am I doing something wrong here?
EDIT: This also seems to be much worse when I’m working in an ‘Empty Level’. If I create a new level using the ‘Default Level’ template, things go more-or-less where they should, although it’s not perfect… Why would that be?