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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

What is the widget equivalent of an Actor Component / how to call C++ functions from a widget blueprint?

I'm making a drag-and-drop menu as a Widget Blueprint. I've been prototyping the simple stuff with blueprints, but I've got to the point where I'm going to need to work in C++. I'm not sure how to do this though.

When I've done this with Actors, I've done it by creating a AActorComponent C++ class and calling its functions from the Actor blueprint. However, widget blueprints don't seem to have a WidgetComponent class. I basically want to make a c++ class with some helpful functions (e.g. an OnDrop function that checks where in the vertical box of children the user has dropped a widget and places it appropriately). What's the correct way of doing this with widgets?

Is the answer that the C++ class needs to be added to the player controller? This doesn't seem to fit with the hierarchy to me, as the C++ class is only interacting with the widget. Surely, it should belong to the widget?

It may be I'm doing this in completely the wrong way, just going on what I've done and been advised before when working with actors.

Product Version: UE 4.18
Tags:
more ▼

asked Jul 18 '18 at 02:18 PM in Blueprint Scripting

avatar image

jmcshopes
1

avatar image mightyenigma Jul 24 '18 at 04:16 PM

I'm not really sure either, but Player Controller is vital to widgets, as the Widget needs an Owner, and Unreal is designed around the idea that each Widget has to have a specific Player Controller be its owner. So that makes it easy to put all your widget controlling code in the Player Controller but I agree, it doesn't seem like the best idea.

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

0 answers: sort voted first
Be the first one to answer this question
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