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"

How can I save different functions so I don't have to write every function in my BP?


i got a struct array for my items, that saves every important value. Its working well, but i know that i can't save functions in it while using the struct in blueprints. Is there a way to save different functions so that i don't have to write every function in my character blueprint? I can't save the object itself, because i destroy it and after 60 sec the pointer would be lost. At the moment i just check what type the item is and use a function in my character blueprint for each itemtype (food->eat, weapon->attack, cloth->equip). But i don't really want to save these in my character blueprint. I would like to have a OnUse function on my items and just use them so i dont have to check for types etc.

I only have one main ItemClass and my Blueprints are different childs of it. ItemClass->Food->Apple ItemClass->Food->Tomato ItemClass->Cloth->Backpack

and so on.

So i can only create function in the first child of the ItemClass. I did this till now, but since i can't save the whole Object (garbage ...) it can't save it's function.

If i can't i will go on and use my character blueprint to just differe the itemtypes and use a function for each...

Product Version: Not Selected
more ▼

asked Aug 11 '14 at 01:26 PM in Blueprint Scripting

avatar image

6.9k 333 186 472

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

2 answers: sort voted first

From what I understand (I think), you want to expose USTRUCT() functions back to blueprints. That is not possible. Only UCLASS (which essentialy means UObject) can have exposed functions back to blueprint.

If you want to have functions which operate on data in USTRUCT() you have 3 options (depends on where you want to use them).

Write functions in C++ in object that is using struct.

Create special object, which will encapsulate struct, with needed functions. You will need then to instance this object, in any object you wish yo use those functions.

If you need these functions only inside editor and not in game, you might be fancy of creating custom property editor for this struct.

USTRUCT() in UE4 world is treated as POCO class.

more ▼

answered Aug 11 '14 at 05:15 PM

avatar image

1.6k 105 98 185

avatar image TJ V ♦♦ STAFF Aug 18 '14 at 07:25 PM

Hi eXi,

We haven't heard back from you in a few days, so we are marking this post as Resolved for tracking purposes. If you're still experiencing this issue, please feel free to post back here.

Thanks, TJ

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

Funtions dont override but event do if i'm not mistaken, you could create dummy event on itemtypes and then override event on diffrent types.

more ▼

answered Aug 11 '14 at 01:54 PM

avatar image

37.8k 937 172 1123

avatar image eXi Aug 11 '14 at 03:41 PM

Can i use a function of an unspawned blueprint? So that i would just look what Class my item is and use the function of the blueprint? Than i could set up my function in the ItemType Blueprints again and check the Item i want to use for its class and use the matching blueprint class.

(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