So I have made a class that contains a USceneComponent, a USkeletalMeshComponent, and a UArrowComponent. The USceneComponent is my root component. The Skeletal mesh attaches to that, and the arrow component attaches to the skeletal mesh. The only problem is I can’t set the mesh in my blueprint after I have created it.
(.h)
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Gun")
UArrowComponent* BulletSpawn;
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Gun")
USkeletalMeshComponent* Gun;
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Gun")
USceneComponent* DefaultSceneRoot;
(.cpp)
DefaultSceneRoot = ObjectInitializer.CreateDefaultSubobject<USceneComponent>(this, TEXT("DefaultSceneRoot"));
RootComponent = DefaultSceneRoot;
Gun = ObjectInitializer.CreateDefaultSubobject<USkeletalMeshComponent>(this, TEXT("Gun"));
BulletSpawn = ObjectInitializer.CreateDefaultSubobject<UArrowComponent>(this, TEXT("BulletSpawn"));
Gun->AttachToComponent(RootComponent, FAttachmentTransformRules::KeepWorldTransform);
BulletSpawn->AttachToComponent(Gun, FAttachmentTransformRules::KeepWorldTransform);
This compiles fine, but when I go to change my skeletal mesh:
I apply it correctly, right? Well it doesn’t save. Every time I hit save, it just resets back to “None”. Anyone know what I’m doing wrong?