create-actor
Create a complete Unreal Engine Actor with C++ class and optional Blueprint child.
SKILL.mdUnrealEngine/skills/create-actor/SKILL.md
GitHubSkill: Create Actor
Description
Create a complete Unreal Engine Actor with C++ class and optional Blueprint child.
Arguments
- {{arg}}: The class name for the actor (e.g., APickupItem)
Steps
Create the header file (
Source/[Project]/{{arg}}.h):- Include UCLASS macro with appropriate specifiers
- Include GENERATED_BODY()
- Declare BeginPlay() and Tick() override
- Add root component (USceneComponent or USphereComponent)
- Add any mesh/collision components as needed
Create the source file (
Source/[Project]/{{arg}}.cpp):- Implement constructor with CreateDefaultSubobject for components
- Set
PrimaryActorTick.bCanEverTick = true;to enable ticking - Set
bReplicates = true;if multiplayer is needed - Implement BeginPlay and Tick
Verify includes are correct and there are no circular dependencies
Build the project to verify the new class compiles
Example
// AMyPickup.h
UCLASS()
class MYPROJECT_API AMyPickup : public AActor
{
GENERATED_BODY()
public:
AMyPickup();
virtual void Tick(float DeltaTime) override;
protected:
virtual void BeginPlay() override;
private:
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="Components")
TObjectPtr<UStaticMeshComponent> MeshComponent;
};