Hello everyone, I am working on making modular weapons for my game and I am trying to use the SkeletalMeshMerge class to create a single mesh, but I keep running into this issue where the FSkelMeshMergeSectionMapping struct is not recognized.
I have been reading through the documentation and I know that FSkelMeshMergeSectionMapping is not a USTRUCT, but just a normal struct. I am fairly new to Unreal Engine so I don’t know why this would be an issue when trying to use it.
This is the declaration of FSkelMeshMergeSectionMapping in SkeletalMeshMerge.h:
struct FSkelMeshMergeSectionMapping
{
/** indices to final section entries of the merged skel mesh */
TArray<int32> SectionIDs;
};
This is my code:
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "CWeapon.generated.h"
class USkeletalMeshComponent;
class UDamageType;
class UParticleSystem;
class UCapsuleComponent;
struct FSkelMeshMergeSectionMapping;
struct FSkelMeshMergeUVTransforms;
USTRUCT(Blueprintable)
struct FWeaponPart
{
GENERATED_BODY()
public:
FWeaponPart()
{
SkeletalMesh = nullptr;
PartDamage = 0;
}
UPROPERTY(EditAnywhere)
USkeletalMesh* SkeletalMesh;
UPROPERTY(EditAnywhere)
float PartDamage;
};
UCLASS()
class COMBATPROTOTYPE_API ACWeapon : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
ACWeapon();
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Components")
USkeletalMeshComponent* MeshComp;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Components")
UCapsuleComponent* CollisionComp;
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Weapon")
TSubclassOf<UDamageType> DamageType;
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "FX")
UParticleSystem* DefaultImpactEffect;
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "FX")
UParticleSystem* FleshImpactEffect;
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Weapon")
float WeaponDamage;
UPROPERTY(EditDefaultsOnly, Category = "Components")
FVector CapsuleOffset;
UPROPERTY(EditAnywhere, Category = "Weapon Data")
TArray<FSkelMeshMergeSectionMapping> MeshSectionMappings;
UPROPERTY(EditAnywhere, Category = "Weapon Data")
int32 StripTopLODS;
UPROPERTY(EditAnywhere, Category = "Weapon Data")
EMeshBufferAccess MeshBufferAccess;
UPROPERTY(EditAnywhere, Category = "Weapon Data")
FSkelMeshMergeUVTransforms* MeshUVTransforms;
UPROPERTY(EditAnywhere, Category = "Weapon Data")
TArray<FWeaponPart> WeaponData;
//Weapon uses only a single mesh
UPROPERTY(EditDefaultsOnly, Category = "Weapon Data")
bool bSingleMesh;
bool CreateWeapon(TArray<FWeaponPart> WeaponParts);
};
Any help would be greatly appreciated.