Whenever I add a UProperty to the physicalmaterial class my solution won't compile

Hi, I’m trying to add a custom variable to the bass physical material class with

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = PhysicalMaterial)
float AudioAbsorption;

but whenever I add it, my solution won’t compile and throws out

11>C:\Program Files\Epic Games\UE_5.3\Engine\Source\Runtime\PhysicsCore\Public\PhysicalMaterials\PhysicalMaterial.h(30): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
11>C:\Program Files\Epic Games\UE_5.3\Engine\Source\Runtime\PhysicsCore\Public\PhysicalMaterials\PhysicalMaterial.h(61): error C2143: syntax error: missing ';' before '<class-head>'
11>C:\Program Files\Epic Games\UE_5.3\Engine\Source\Runtime\PhysicsCore\Public\PhysicalMaterials\PhysicalMaterial.h(61): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
11>C:\Program Files\Epic Games\UE_5.3\Engine\Source\Runtime\PhysicsCore\Public\PhysicalMaterials\PhysicalMaterial.h(63): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

despite the fact that my new property is on lines 72/73.

Also when I then remove my new code the system refuses to rebuild succesfully.

Are you trying to modify the PhysicalMaterial.h file? I hope you are just extending it with your own class.

A quick material test file:
.h

#pragma once

#include "CoreMinimal.h"
#include "PhysicalMaterials/PhysicalMaterial.h"
#include "MyPhysicalMaterial.generated.h"

/**
 * 
 */
UCLASS()
class YOUR_API UMyPhysicalMaterial : public UPhysicalMaterial
{
	GENERATED_BODY()
	
public:
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = PhysicalMaterial)
	float AudioAbsorption;
};

.cpp

#include "MyPhysicalMaterial.h"

Compiles fine.

Goddamnit I don’t know what I was doing wrong!
I attempted extending it but couldnt get it to work ( I assume because I was trying to do this in editor rather than my solution ) and now I’ve messed with the source code of the original file I have fix my engine. Thanks for your comment!

Just revert the probably 2 files you changed and it should work :wink:

In a worse case scenario just download the physics material header and cpp from the source off of GitHub and swap em :slight_smile: