Hi,
I am trying to set up a grid where players can break blocks kinda like Bomberman. For the mesh, I am using a HISM and using the “remove instance” function to get rid of each block when the player attacks it. Everything works great in blueprints but when I try to change it to c++ everything breaks.
Here is the code that I am using (.h)
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "Grid.generated.h"
class UHierarchicalInstancedStaticMeshComponent;
UCLASS()
class GLEEF_API AGrid : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
AGrid();
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
UPROPERTY(EditDefaultsOnly, Category = "Mesh")
UHierarchicalInstancedStaticMeshComponent* BlocksHISM ;
public:
};
#include "Grid.h"
#include "Components/HierarchicalInstancedStaticMeshComponent.h"
// Sets default values
AGrid::AGrid()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
//PrimaryActorTick.bCanEverTick = true;
BlocksHISM = CreateDefaultSubobject<UHierarchicalInstancedStaticMeshComponent>(TEXT("HierarchicalInstancedStaticMeshComp"));
}
First, I tried to do everything in c++ but nothing worked at all. Now, I am trying to just create a HISM in c++ and use the contrusction script in blueprints to create a grid but that breaks and does really weird things. Is there something I have to setup in c++ that is done in blueprints for me?
Thank you.