Answer the question
In order to leave comments, you need to log in
Why is the object mesh not displayed in the editor?
Good day to all, actually such a question - I created a class from an AActor object in C ++, declared a pointer to USkeletalMeshComponent* and initialized the pointer with a new object in the class constructor
WeaponMesh = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("WeaponMesh"));
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "BaseWeapon.generated.h"
UCLASS()
class ADVANCEDLOCOMOTIONV3_API ABaseWeapon : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
ABaseWeapon();
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Weapon")
USkeletalMeshComponent* WeaponMesh; //weapon mesh
};
#include "BaseWeapon.h"
#include "Components/SkeletalMeshComponent.h"
// Sets default values
ABaseWeapon::ABaseWeapon()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = false;
WeaponMesh = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("WeaponMesh"));
}
// Called when the game starts or when spawned
void ABaseWeapon::BeginPlay()
{
Super::BeginPlay();
}
// Called every frame
void ABaseWeapon::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question