Can't edit transform of actor

I have a class that inherits from AActor.

class AEnemyGroup : public AActor

This class does not have any USceneComponent, and this makes that I can’t edit the transform of the object in the editor. Besides, if I move the object somehow (by piloting it for example) it gets moved back to the origin. I need to modify the position of the object for gameplay logic purposes, and the editor won’t let me. Any way of doing this?

If your actor requires a physical location in the world you must have a scene component. Why not just add one?

.h

UPROPERTY(EditAnywhere, BlueprintReadWrite)
class USceneComponent* SceneComponent;

.cpp

#include "Runtime/Engine/Classes/Components/SceneComponent.h"

AEnemyGroup::AEnemyGroup()
{
        SceneComponent = CreateDefaultSubobject<USceneComponent>(TEXT("SceneComponent"));
        SetRootComponent(SceneComponent);
}
1 Like