While my original problem is complex, I can repro the issue with a simple plugin I created. I created a plugin that will allow me to create a simple racing track, with two straights side by side and simple round semi-circles at the end of each straight to connect the loops.
The OvalTrack.h header looks like this (if I forgot something)
#pragma once
#include “CoreMinimal.h”
#include “GameFramework/Actor.h”
#include “Components/SplineComponent.h”
#include “OvalTrack.generated.h”
UCLASS(BlueprintType, Blueprintable)
class OVALTRACKGENERATOR_API AOvalTrack : public AActor
{
GENERATED_BODY()
public:
AOvalTrack();
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Track")
float StraightLength;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Track")
float TrackWidth;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Track")
float RoundedEndRadius;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Track")
USplineComponent* SplineComponent;
virtual void OnConstruction(const FTransform& Transform) override;
};
And the cpp file looks like this
#include “OvalTrack.h”
#include “Components/SplineComponent.h”
AOvalTrack::AOvalTrack()
{
// Do Something
}
void AOvalTrack::OnConstruction(const FTransform& Transform)
{
// Do something
}
The plugin compiles fine. The issue is that when I pick the class to create a basic blueprint from it, I then create a variable that will hold all the 3 elements that will define the track, but when I try to set the variable type, I cant find the AOvalTrack class in this case so I am unable to create an array that will have the elements that I can assign the track length, radius and width parameters.
I have
- Make sure your class has the
UCLASS(BlueprintType, Blueprintable)
macro. This tells Unreal Engine that the class can be used in Blueprints. - Ensure your class has the correct API export macro, which should be the same as your plugin’s API macro, e.g.,
OVALTRACK_API
orTRACKGENERATORPLUGIN_API
, depending on your project and plugin names. - Rebuild your project and plugin. You may need to delete the “Intermediate” and “Saved” folders, regenerate the Visual Studio project files, and then clean and build your project in Visual Studio.
- Restart the Unreal Editor after rebuilding to ensure the changes are detected.
- In the Content Browser, right-click and choose “Create Basic Asset” > “Blueprint Class.”
I also have
- Make sure that the
OvalTrackGenerator.uplugin
file has the"Type": "Runtime"
setting in the “Modules” section. This ensures the plugin is loaded during runtime, which is required for the class to be exposed to Blueprints. - Double-check the plugin is enabled in the Unreal Engine Editor by going to Edit > Plugins and searching for “OvalTrackGenerator”. If it is not enabled, enable it and restart the editor.
- Make sure that the project was compiled successfully after making changes to the code. This is important for the updated class information to be recognized by the editor.
Finally I have made sure that I did
○ Open the "OvalTrack.Build.cs" file in a text editor.
○ Add the following lines to the PublicDependencyModuleNames list:
"CoreUObject",
"Engine",
"Slate",
"SlateCore",
"Kismet"
So I am out of ideas why I can’t set the correct class as the type of the variable that will let me assign values to my blueprint