Unable to Move Specific Object in Editor (UE5)

I have created a new AActor object using the Tools → Create new C++ Class menu. There is no code in this class beyond what is auto-added by this wizard. However, when I place this object in my level, though I can see its handles in the editor view (i.e. my transform controls are not hidden or disabled), I cannot move the object. Anytime I drag it, its position immediately resets when I let go. Additionally, it has no Transform component in the Details view. No other objects in my level behave this way, only this shell AActor has the problem. Does anyone know what is causing this?

  • are you sure it’s derived from AActor? Does it have the right syntax in the class definition
    example:

class YOUR_API newActorClassName : public AActor
{…

  • did you build your project from source once you added the c++ class (if it was the first)

Yes, and Yes. This is the full .h file of the class, and the cpp only contains the basic definitions of these functions, calling super and that’s it.

UCLASS()
class SHOOTERGAME_API ABowLevelExitPoint : public AActor
{
	GENERATED_BODY()
	
public:	
	// Sets default values for this actor's properties
	ABowLevelExitPoint();

protected:
	// Called when the game starts or when spawned
	virtual void BeginPlay() override;

public:	
	// Called every frame
	virtual void Tick(float DeltaTime) override;

};

After adding it, I’ve closed everything and rebuilt from source to re-open the editor.

Are you dropping in a pure c++ class by any chance into the editor?
Try creating a blueprint based on it and putting it in the editor and see if you can move it.

Ah, I am yes. I can try a BP, I was not sure if unreal required basically everything to be a BP or not

A BP does work, however I’m confused as to why I can directly add a c++ AActor but not a c++ AActor descendant.

when a Blueprint class is created directly from AActor, it has a USceneComponent* Set as the Actors Root component.

When you create your own C++ class derived from AActor, you need to add a root component derived from USceneComponent, if you want to edit its transform.

Try Adding this to your constructor:

USceneComponent* Root = CreateDefaultSubobject<USceneComponent>(TEXT("Root"));
Root->SetMobility(EComponentMobility::Static);
SetRootComponent(Root);

Ah, I see. Thank you.

missed to reply by a couple of seconds. Can confirm.
just add:

USceneComponent* SceneComponent = CreateDefaultSubobject(TEXT(“RootComponent”));
RootComponent = SceneComponent;

to your constructor and it is movable.

1 Like