How to fix (or suppress) incorrect "function is inaccisible" squigles

Hello,

I am just getting started with Unreal and am following the “Unreal Engine 4x by Example” book. I am having an issue with Visual Studios intellisense where it is incorrectly attributing errors to working code, saying that the function is “inaccessible”.

The code works fine, but the false-errors in the IDE are very annoying. Does anyone know how to fix, or at least suppress these errors?

code snippet:

UStaticMeshComponent* SphereVisual = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("SphereMesh"));

ConstructorHelpers::FObjectFinder<UStaticMesh> SphereAsset(TEXT("/Game/StarterContent/Shapes/Shape_Sphere.Shape_Sphere"));

ConstructorHelpers::FObjectFinder<UMaterial> SphereMaterial(TEXT("/Game/StarterContent/Materials/M_Metal_Burnished_Steel.M_Metal_Burnished_Steel"));

if (SphereAsset.Succeeded() && SphereMaterial.Succeeded()) {
	SphereVisual->SetStaticMesh(SphereAsset.Object);
	SphereVisual->SetRelativeLocation(FVector(0.0f, 0.0f, -50.0f));
	SphereVisual->SetMaterial(0, SphereMaterial.Object); // <--- set material shows an intellisense error 
}

screenshot of the error:

I have seen some suggest just turning off error reporting as a whole, but I’m hoping there might be a way to not throw the baby out with the bath water.

Thanks

I’m having the same issue. Lotsa functions are reported as inaccessible by intellisense… or Resharper in my case.
It compiles and works, but very annoying and makes me spend time looking at issues that aren’t issues.

I’ve tried to clear the resharper cache and such without any luck. I do think it is because these functions are not explicitly set as public in the classes. Instead this is left to the GENERATED_UCLASS_BODY() macro.

This didn’t use to be a problem, so maybe something changed with 4.20?

–kg

This could be caused by this

–kg

Yep, looks like it was that issue, fixed on 4.20.3

The issue is caused by generated headers and intellisense not knowing where to look for. You can solve this by adding all Intermediate/Build/Win64/UE4Editor/Inc/* folders to your include path. You may need to look for additional plugins.
Side not: this errors should not affect compiling. You want to look for the ones in the Engine folders as much as the ones from your project folder.