Adding classes in Visual Studio

That should work, however UClass() should be UCLASS()

Your class name with also need to start with a U (for UObject), or A (for AActor) for the UHT to parse it correctly. The UHT should error in that case though and tell you this.

Hi!

When I added a class through visual studio it don’t compile, even if it has the same structure as a file generated from the editor would get.

#pragma once

#include "Components/SceneComponent.h"
#include "CustomSceneComponent.generated.h"

UClass()
class CustomSceneComponent: public USceneComponent
{
public:
	GENERATED_UCLASS_BODY()
};

It can’t find e.g. UClass or UObject and compilation fails. I tested to uncomment the “generated” header but that didn’t work either. For some reason no header is generated for this class, where do you edit that? This is quite a big problem for me since I want to be able to move code files between projects and in its current state that seems not possible to do. Is there any manual configuration I can set to make the project aware of the files?

Oh, that’s a typo =) Since I had a typo I got a confusing error message. When I corrected it I saw that I had forgot to add #include "MyProject.h" in my .cpp file, where “MyProject” is the name of my project. Thank you for pointing that out, it works fine now!