How do I properly import ProceduralMeshComponent to my project?

I have been trying to generate terrain using ProceduralMeshComponent but when I try to include the header file it says
> cannot open source file “ProceduralMeshComponent.h”
The GENERATED_BODY() is also throwing an error saying
> this declaration has no storage class or type specifier

I have attached my build.cs and .uproject files. After updating these files I rescanned the project by right clicking on my project name and the clicking rescan solution.

I have checked that the plugin for ProceduralMeshComponent is enabled.

I am new to unreal and know what to try next.

1 Like

I’m replying to a very old post but to save newcomers like me the turmoil of trying to work this out there are multiple steps to get this to work:

Along with enabling the Plugin via UE Editor, you also need to update the YourProjectName.Build.cs file in your project.

Add “ProceduralMeshComponent” to the public dependency list of elements within the curly braces, don’t forget the comma separator i.e.:
PublicDependencyModuleNames.AddRange(new string[] { …, “ProceduralMeshComponent” });

Save the file and close the project from both Visual Studio and the UE Editor.

From your project folder, there should be a .uproject file present, left-click on that file and select the option for “Generate Visual Studio project files”.

Once that’s completed, open up the project via the UE Editor and include the header file to your code. VS may take a little while to update.

5 Likes

Thank you!!! I’m that newcomer you targeted to save