x

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"

Creating a Blueprint implementable function in C++

So, I know there are tons of questions out there asking the same thing, but i cannot seem to get anything to work.

This is what i tried:

Playercharacter.h

 UFUNCTION(BlueprintNativeEvent)
     void SetInventoryItemsGUI_Implementation(TArray<FText> items);


PlayerCharacter.cpp

 void APlayerCharacter::SetInventoryItemsGUI_Implementation(TArray<FText> items){
 
 }

I am getting these errors:

 \HorrorGame\Intermediate\Build\Win64\UE4Editor\Inc\HorrorGame\HorrorGame.generated.cpp(160): error C2511: 'void APlayerCharacter::SetInventoryItemsGUI_Implementation(const TArray<FText,FDefaultAllocator> &)' : overloaded member function not found in 'APlayerCharacter'
 
 \HorrorGame\Source\HorrorGame\PlayerCharacter.h(18) : see declaration of 'APlayerCharacter'
 
 HorrorGame.generated.cpp(163): error C2352: 'UObject::FindFunctionChecked' : illegal call of non-static member function
 
 c:\program files\epic games\4.9\engine\source\runtime\coreuobject\public\uobject\UObject.h(752) : see declaration of 'UObject::FindFunctionChecked'
Product Version: UE 4.10
Tags:
more ▼

asked Jan 23 '16 at 01:51 AM in C++ Programming

avatar image

joelComberiati
112 26 22 28

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

1 answer: sort voted first

At base declaration, you declere native event without _Implementation surrfix

 UFUNCTION(BlueprintNativeEvent)
 void SetInventoryItemsGUI(TArray<FText> items);

UHT will generate _Implementation deceleration automatically so you don't need to declare it, but in farther subclasses you override implementation using the surrfix like this:

 virtual void SetInventoryItemsGUI_Implementation(TArray items) override;

and always you define (code) function with that surrfix where ever you use it, so don't change anything in cpp

more ▼

answered Jan 23 '16 at 02:31 AM

avatar image

Shadowriver
35.9k 928 169 1105

avatar image joelComberiati Jan 23 '16 at 02:57 AM

I just tried this, and yet im getting the same error

avatar image Shadowriver Jan 23 '16 at 03:03 AM

change argument to as error say that generated code wants

 const TArray<FText> items

or

 TArray<FText>& items

avatar image joelComberiati Jan 23 '16 at 03:09 AM

AH, its magic, it works, I tried making it a static function. Cant believe I didnt think of that, thanks

avatar image joelComberiati Jan 23 '16 at 03:22 AM

actually its not showing up in the blueprint

avatar image joelComberiati Jan 23 '16 at 03:32 AM

I also tried changing it to a BlueprintImplementableEvent, and then got rid of everything in the .cpp file

avatar image Shadowriver Jan 23 '16 at 03:35 AM

Where do you looking? do you look for event or function override? if you dont see in one it will be in another. If i remeber right it depends on if your function return anything or not

avatar image joelComberiati Jan 23 '16 at 04:08 AM

I checked both, and then searched it, but I will check again, I also tried searching it by right clicking and putting in the name

avatar image joelComberiati Jan 23 '16 at 04:55 PM

turns out hot reload does not work, its in there now

avatar image Shadowriver Jan 23 '16 at 05:26 PM

Ok :) yea hot reload is buggy

(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