I just made a c++ class which extends UInstancedStaticMeshComponent. I need to add an include for “InstancedStaticMesh.h”. When I do this, the build fails with “No such file or directory”. The include is the only change I’ve made to my .h at all:
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Components/InstancedStaticMeshComponent.h"
#include "Engine/InstancedStaticMesh.h" // also fails with just "InstancedStaticMesh.h"
#include "ParametricInstancedSMComponent.generated.h"
/**
*
*/
UCLASS(ClassGroup = (Custom), meta = (BlueprintSpawnableComponent))
class RPG_API UParametricInstancedSMComponent : public UInstancedStaticMeshComponent
{
GENERATED_BODY()
};
I’ve read that I need to regenerate project files on the .uproject, which makes no sense and didn’t work. I’ve also read that my includes all need to come before the .generated.h include, which I’ve done. I’ve read that I may need to add a “module” dependency to build.cs, but I have no idea which module would have InstancedStaticMesh.h or how to find out. What exactly do I need to do here?
I come from an environment (Eclipse/Java) where this is a complete non-issue. If I so much as try to use a class I haven’t imported, my IDE would suggest possible ones I might mean, and let me add the exact import statement I need in one click. To have an IDE be this needlessly obstructionist is not acceptable.
[EDIT] Including the full path of the file starting from /source/ fixed the issue:
#include "Runtime/Engine/Private/InstancedStaticMesh.h"/
Is this the proper way to include engine .h files? (I read somewhere that using the full path was a bad practice).