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"

The thought process behind C++ and blueprints

So I've been fiddling with UE4 for a couple weeks now and I'm a bit confused on how exactly I'm suppose to integrate both C++ and blueprint into my workflow. I know this article:

https://wiki.unrealengine.com/Blueprints,_Creating_Variables_in_C%2B%2B_For_Use_In_BP

says that the blueprint system is a great way for both the programmer and the designer to work with variables and functions. However, I've noticed something. In my 2d fighting game I have a camera actor. Within this camera actor I want to gather all characters found within the level and assign them to variables so I can use them in functions. I created my character class variables within my C++ CameraActor class. In order to assign them values I gather references of the actual characters at runtime with a for loop within the BeginPlay() function and assign these references to my declared character (pointer) variables. However, when I declare these variables to be used within the blueprinted class they are technically not yet assigned to anything (Since the BeginPlay() function in the C++ class isn't called until the game runs) and so I can't perform any operations on them without getting an error from blueprint.

My question is how am I suppose to think about the 'marriage' between C++ and blueprints in UE4? Should I only be attempting to expose variables to blueprint for which I plan to assign in blueprints? Or Is the programmer and the designer just suppose to both use the variable as they see fit (possibly resulting in duplicate code and other things) and then just reconcile the differences periodically? Any suggestions appreciated.

Product Version: UE 4.10
Tags:
more ▼

asked Apr 21 '16 at 01:35 PM in C++ Programming

avatar image

Boagz
50 14 21 28

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

1 answer: sort voted first

Im not big one in ue4 c++ so i dont quite understand problem described in first paragraph, but i have worked on c++ and blueprint project, with bp -> c++ and even c++ -> bp communication without any issues.

From my experience, i think Variables should be created and initialized in C++ as much as you can. Also avoid using dependent function on begin play, other objects might not be ready yet.

more ▼

answered Apr 21 '16 at 05:21 PM

avatar image

CriErr
1.2k 57 21 57

(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