Blueprint marked functions in Component don't show in the event graph browser

My C++ class has functions marked as BlueprintCallable, but they don’t show up in the Blueprint Event Graph editor.

My goal is to add several functions that can be called from Blueprints. For example, I want to create a function FVector GetForce() const;. However, after days of troubleshooting, I can’t get this function to appear.

Here’s the simplified C++ subclass I created:

UCLASS(ClassGroup = Newton, meta=(BlueprintSpawnableComponent), HideCategories = (Physics, Collision), MinimalAPI)
class UNewtonRigidBody : public USceneComponent
{
	GENERATED_BODY()
	class NotifyCallback;

public:
	// Sets default values for this component's properties
	UNewtonRigidBody();

	// Blueprint interface
	// UFUNCTION(BlueprintCallable, Category="Newton")
	// FVector GetForce() const;

	UFUNCTION(BlueprintCallable, Category="Transformation")
	FVector GetUpVectorNotWorking() const;
};

To investigate, I added another function, FVector GetUpVectorNotWorking() const;, but it still didn’t work. I followed instructions from this tutorial on exposing C++ to Blueprint carefully, so I don’t believe I’m missing any steps.

Here’s what I’ve checked so far:

  1. I’ve confirmed that if I create an Actor subclass of AActor instead, the new functions do show up in the Blueprint editor.
  2. I’ve tried refreshing and rebuilding the project several times, but it hasn’t helped.

The video below demonstrates the problem in action:

So people suggest thing liek this

  • Class Inheritance: Functions in subclasses of USceneComponent can sometimes behave differently than those in AActor classes when exposed to Blueprints. Testing with AActor was a good step, but if this is mandatory in a component class, try re-parenting or switching to UActorComponent to see if it makes a difference.

but in my case this is no an option since my class must be movable.

  • Meta Flags and Blueprint Category: Use Blueprintable in the UCLASS specifiers if you haven’t already. Some other useful meta tags could include BlueprintType or BlueprintInternalUseOnly, depending on your use case.
    this is on the side that I have no idea what it mean.

does any one has any insight as to what I am doing wrong or missing?

1 Like

Here is the video showing how the same component act different when parented from my own actor subclass

If a C++ complements can only be full functional when parented from a custom actor class.
seem like a really serious problem, in fact, a show stopper.

I also looked over the code for hints that suggest SceneCompoment was a terminal class, but is is not. A search for any sub class will show almost hundred of them

One the simple example I is the UDecalComponent which is the model I took as sample template and edited to make my class.

I’d like to think, I am one of the few people who has experienced this problem, and I am missing a step or two. Because this problem render unreal useless for any serious developer trying to write an app more complex than simple Blueprint script or simple C++ classes for speeding up stuff.

If anyone is interested is reproducing this problem. The source for the plugin is here.

2 Likes

I have just tried doing the same thing in 5.3 and did not have this issue. From the looks of it, there is nothing wrong with the function itself. The only things that come to mind is the lack of the <PROJECT>_API before the class name and the usage of MinimalApi, however the latter should not affect blueprints as they kind of bundle all modules together anyway.

1 Like

ah thank for the reply. yes is such a huge problem, that I am thinking that this is a problem on my side, I jsut do no understand whey is so incorrect. is .

the current installer version 5.4.4
I am hopping that is not the problem

on the _API I was wondering about that, how does that get generated.
I created the plugin as one of the template. Is that something one has to do manually?

Tonight I will try to recreate dthe project again and copy the class one at a time.

2 Likes

It’s unlikely that the issue is caused by the different engine version unless there is a bug in 5.4.4. You could check the bug tracker but probably it’s not the case since we are talking about a core engine functionality of calling C++ functions in blueprints.

The _API bit is there so that the code is exposed to other modules. I remember having some issues that were caused by it being missing. If the class is a part of a plugin that has a single module, it should have the form of <PLUGIN_NAME>_API. You can type it yourself based on the name of the module the class resides in or have it generated if your IDE supports it. I have experience with Rider where you could auto-generate plugins/modules/classes and it would add it accordingly.

Rather than copying the classes, you could try to create a blank project and only make the scene component. If you get it to work, you can check what’s different between the new project and the old one. It is unlikely that copying the classes is going to work unless you messed up your build files, etc.

2 Likes

I tried the easies check first remove MinimalAP

UCLASS(ClassGroup = Newton, Blueprintable, meta=(BlueprintSpawnableComponent), HideCategories = (Physics, Collision))

but that make no difference.

second, I created a new plugin test.
I can verify that any dll_Impot /dll_export preprocessors like.
#define TESTPROJECT_API DLLEXPORT

then, I try making a sub class component from USceneComponent as part of the project
and for that one, the class indeed has the DLLEXPORT and look liek that.

UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class TESTPROJECT_API UMySceneComponent : public USceneComponent
{
	GENERATED_BODY()

public:	
	// Sets default values for this component's properties
	UMySceneComponent();

protected:
	// Called when the game starts
	virtual void BeginPlay() override;

public:	
	// Called every frame
	virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;

	UFUNCTION(BlueprintCallable, Category="Transformation")
	FVector TestFunction() const {return FVector(0.0, 0.0, 0.0);}
	
};

them I made an identical class but part of the plugin, and that one looks like this

UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class UMyPlginSceneComponent : public USceneComponent
{
	GENERATED_BODY()

public:	
	// Sets default values for this component's properties
	UMyPlginSceneComponent();

protected:
	// Called when the game starts
	virtual void BeginPlay() override;

public:	
	// Called every frame
	virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;

	UFUNCTION(BlueprintCallable, Category="Transformation")
	FVector TestFunction() const { return FVector(0.0, 0.0, 0.0); }
	
};

them after going the whole unreal ritual afte adding new c++ code.
in the gragh editor only that first class shows the function TestFunction when I add them to and AActor blueprint. the second one disappear.

but if I add them to a custom subclass of AActor Blueprint, then they are listed as that functions.
them the all teh function are callable from blueprints.

I am at a total lost, it seem that plugins functions do no export function to blueprints, or at least, there is a mechanism that I am not aware off.

I agree this seems like might be linkage type, but again that idea are these points:

1- plugins do not have a way to generate those macros classes made for pluging.
I tried naively to add one but those macros are no so trivial, unreal generate the by running at tool inside visual studio, when I added them manually I get linkage error.

2- the fact that the functions are visible to customs blueprint, tells me that it is not linking type, this seems more like a big bug in teh unreal tool parcel when processing UFunction for plugin classes.

1 Like

Well, I just created a new project in 5.4.4, made a plugin in it and added a scene component subclass with the same function you have and it works.

I have tried using your plugin and something weird is going on with it. I have managed to get it to work a couple of times but it’s not consistent. What I did were the following steps but when doing them again to figure out what exactly is fixing the issue, it would sometimes not even work:

  • Changing the plugin type to Runtime from Editor
  • Moving the NewtonRigidBody.h file to the public directory from the private one
  • Removing the MinimalApi declaration and adding the NEWTON_API declaration to the class
  • Adding a new scene component subclass to the public directory with the NEWTON_API and one of the functions copied from the rigid body class

No idea why it would not work again despite doing the same steps. I did regenerate the project solution after doing each of the steps and no luck. I did all the steps again and it would not work for some reason. So try tinkering with these and see if you can get it to work. Otherwise I am kind of running out of ideas here so somebody more experienced needs to step in and help you out.

1 Like

oh thank you for those tips, I am going to apply them one at a time now.
The only part I am not clear, is how the NEWTON_API is generated, I can always make a dummy one in my coming file, so I will try that.

I have try to get this to work, but I have not seen that define created for any plugin templates modes in the editor.
can you tell me how you manage to generated it?

I am not experience either, I am learning as I go.
I try this about 15 years ago and few time after on an off,
but is was just too hard or near impossible to add a plugin to unreal at that time.
This is the friendlier I’d seen. It is still much harder than I wish it was.
It forces the writer to expend an extraordinary amount of time researching things that are far,
far away from the scope of the task.

Still, it is like the say, never look gifted horse in the mouth. :sweat_smile:

actually, in making the dummy macro,

#define NEWTON_API DLLEXPORT

I found it where it is defined by the editor. this file.,
C:\unrealProjects\seminar_01\Plugins\newton\Intermediate\Build\Win64\x64\UnrealEditor\Development\newton\Definitions.newton.h

the problem is that Visual studio does not find it, because it is not part of the project test,
it is part of the plugin. chnge the search path does find it. anyone that one problem solved.

oh thank you for those tips, I am going to apply them one at a time now.
The only part I am not clear, is how the NEWTON_API is generated, I can always make a dummy one in my coming file, so I will try that.
I have try to get this to work, but I have not seen that define created for any plugin templates modes in the editor.
can you tell me how you manage to generated it?

AFAIK the API bit is there just so that the code is exposed to other modules. As I have stated before, Rider tends to correctly auto-generate it when creating plugins/modules/classes. I have yet to see it in any form other than than <MODULE_NAME>_API.

I am not experience either, I am learning as I go.
I try this about 15 years ago and few time after on an off,
but is was just too hard or near impossible to add a plugin to unreal at that time.
This is the friendlier I’d seen. It is still much harder than I wish it was.
It forces the writer to expend an extraordinary amount of time researching things that are far,
far away from the scope of the task.

Yeah, working with UE is difficult since you have to go through the engine code or do a lot of trial and error to figure out how it works. That’s the price for using a big studio engine without being a big studio. They are expected to hire a lot of developers who have already gone through the engine and have the knowledge/experience.

#define NEWTON_API DLLEXPORT

Since the define is auto-generated, I don’t think defining it manually is desirable (if that’s what you did). That might lead to conflicts and more confusion with multiple declarations. But hey, if you got it to work, I am happy for you.

Applied all the changes and it actually all worked. Woo-hoo!!

No only that, but now all the functions show up in teh graph editor. This is a huge relief.
Next, I promoted the blueprints demos to the base class, and it all works as expected,

I updated the download, in case you want to check again. :grinning:

In case you wonder what is this plugin all about.
Basically I am integration the NewtonDynamics Physics library to unreal so that it can be used unreal and a high end powerful editor with powerful graphics, to quickly prototype contractions of rigids and joints and test it in real time. Stuff like robots and vehicles.

The focus is one accuracy and realism, at least real life plausibility, therefore, is will have a small scope of applications.

at least that the idea.

again, thank man