[C++] How to make an actor placeable

Hi all

I have created an Weapon class which extend from Item class wich extend from AActor (in C++)
but when I’m placing a BP weapon (entend from Weapon class(c++)) I can’t move it on the world

What I have done wrong ?

This is my Item Class :

#pragma once

#include "GameFramework/Actor.h"
#include "Item.generated.h"

namespace EItemType
	enum Type
		IT_ARMOR UMETA(DisplayName = "Armor"),
		IT_ARMOR_MOD UMETA(DisplayName = "Armor Mod"),
		IT_WEAPON UMETA(DisplayName = "Weapon"),
		IT_WEAPON_MOD UMETA(DisplayName = "Weapon Mod")

UCLASS(BlueprintType, Blueprintable)
class AItem : public AActor

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Item")
	TEnumAsByte<EItemType::Type> ItemType;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Item")
	FString _name;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Item")
	FString _description;

	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Mesh")
	TSubobjectPtr<USkeletalMeshComponent> ItemMesh;


the C++

#include "Resistance.h"
#include "Classes/Items/Item.h"

AItem::AItem(const class FPostConstructInitializeProperties& PCIP)
	: Super(PCIP)
	ItemMesh = PCIP.CreateDefaultSubobject<USkeletalMeshComponent>(this, TEXT("ItemMesh"));
	ItemMesh->MeshComponentUpdateFlag = EMeshComponentUpdateFlag::OnlyTickPoseWhenRendered;
	ItemMesh->bChartDistanceFactor = true;
	ItemMesh->bReceivesDecals = false;
	ItemMesh->CastShadow = true;
	ItemMesh->SetCollisionResponseToChannel(COLLISION_WEAPON, ECR_Block);
	ItemMesh->SetCollisionResponseToChannel(ECC_Visibility, ECR_Block);
	ItemMesh->SetCollisionResponseToChannel(COLLISION_PROJECTILE, ECR_Block);


What do you mean you can’t move it on the world? Do you mean you can’t place it in the level? If that’s the case, what you need might be UCLASS(BlueprintPlaceable, etc).

It’s UCLASS(Placeable,…) not BlueprintPlaceable.


I have try it bue I get this during compilation :

Erreur	1	error : In Item: The placeable specifier is deprecated. Classes are assumed to be placeable by default.	D:\Dust of World\Resistance\Source\Resistance\Classes\Items\Item.h	22	1	Resistance

Yop i thought this would happen. Normaly you don’t need this specifier.

Do you get any error when you try to place it into your scene or is just nothing happening?

My BP weapon W_test, use an skeletal Mesh instead of static mesh that can be the problem ?

How can I have a choice Skeletal and Static Mesh ?

nop nothing

I found my error I just Forgot that :

RootComponent = ItemMesh;

in the C++