Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

BlueprintNativeEvent not showing pins in the event node in the graph editor?

Are not the input and output parameters supposed to show up in the Blueprint Graph Editor if I declare a BlueprintNativeEvent like so? For me, the event does show up, but I never see any pins no matter how I change the C++ code. I see only the Event node with an Exec pin and that is all. I've closed the UE4 editor and restarted it, clean compile, tried creating a totally new blueprint derived from my test pickup class, but there is no change. If I just create the event in the blueprint editor, I can of course add inputs to the event and it's fine. This problem I'm experiencing is that the editor seems to not be picking up my C++ parameters from code. Am I missing something?

Here's the simple test code in question (just to see what pins show up on the event node in the graph editor):

 class SOMEGAME_API APickup : public AActor
     int32 OnPickedUp(int32 PickupIndex);    

     APickup(const FObjectInitializer& ObjectInitializer);

 int32 APickup::OnPickedUp_Implementation(int32 PickupIndex)
     if (GEngine)
         GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, TEXT("OnPickedUp Event"));
     return 0;
Product Version: Not Selected
more ▼

asked Feb 03 '15 at 04:01 AM in C++ Programming

avatar image

173 8 68 28

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

With the code you have now, you should be able to implement the function from Blueprint, like in this picture:

alt text

But you won't be able to call the function. If you try to find it in the 'add node' dialog, it will come up missing:

alt text

That's because you've only marked the function to be implementable by Blueprints, not actually callable. You need to change your function declaration to look like this:

 UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "Pickups")
 int32 OnPickedUp(int32 PickupIndex);

And now you should be able to call it from Blueprint:

alt text

Make sure you close the editor before rebuilding from C++ to make sure the module was reloaded correctly.

pickedup.png (151.6 kB)
pickupfind.png (92.8 kB)
pickupfound.png (99.8 kB)
more ▼

answered Feb 03 '15 at 06:13 AM

avatar image

2.4k 101 72 124

avatar image Silverleaf1 Feb 03 '15 at 06:51 PM

The C++ event should be showing up as the 'red' colored event node in the editor the same as if you chose something like EventActorBeginOverlap or EventBeginPlay. This is an event that can be fired in C++ code and used in the event graph of the blueprint. I am getting the red OnPickedUp event as I'd expect, but there are no pins mirroring the parameters I added in code as shown above.

I went ahead and added BlueprintCallable and a Category just for grins, (even though BlueprintCallable is supposed to be for blueprint to c++ direction) and there was no difference.

BlueprintImplementable and BlueprintNativeEvent are for talking to blueprints from C++ to blueprint direction. BlueprintCallable is for going from blueprint to C++ direction and so is not what I'd be after.

With BlueprintNativeEvent, the blueprint can override the C++ function if it wants, but if it doesn't, then the C++ code is what fires instead as the fallback default behavior.

avatar image cancel Feb 03 '15 at 06:59 PM

Perhaps you phrased your question in a confusing way. If so, I'm not really sure what you're trying to do or what your problem is.

If you want a 'red' node, you have to declare a BlueprintImplementableEvent that has a void return value. If your BlueprintImplementableEvent returns a value, then it will show up as an overrideable function instead of as a red event node that you can place on the event graph.

With the code you posted, it's not possible to get a red event node. I'm not sure what you're seeing on your screen.

avatar image Silverleaf1 Feb 07 '15 at 12:31 AM

It turns out I was having some strange compiling issues and UE4 was not reflecting my code changes. I got that sorted and now I get the above as you described.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question