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"

Get Reference to a Blueprint-created Game Mode in C++

So I've found how to get references to blueprints within C++ using ConstructorHelpers. However, what I want to do is to get a reference to my custom Game Mode that I've created in a blueprint, but not in C++ code, for a class that I'm making in C++. The issue Im facing is that my custom Game Mode class isnt showing up as a valid class to use. Do I need to recreate my game mode class in C++, or is there a way to get the blueprint version in C++?

Product Version: Not Selected
Tags:
more ▼

asked Jan 21 '15 at 06:20 PM in C++ Programming

avatar image

conneich
18 4 6 8

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

You can't generally see a pure blueprint class in C++. This is basically because blueprint does not have C++ headers.

Some possible solutions are:

  1. Create your game mode in C++.

  2. Create the skeleton of the game mode in C++ (i.e., the main functions you are going to call) and the override them in Blueprint. When you request the game mode and cast to your C++ class you should be able to call appropriate methods which blueprint has overriden (I think).

  3. Create an interface in C++ and have your Blueprint game mode implement the interface. Then in C++ you can get the game mode and call the interface functions.

I personally would recommend 3 since it allows mixing C++ and Blueprint in pretty flexible ways. But I've just spent some time figuring out how interfaces in C++ and Blueprint work which is pretty complicated so you might prefer a different approach.

Good luck, -X

more ▼

answered Apr 24 '15 at 09:05 PM

avatar image

Xarol
358 20 32 38

(comments are locked)
10|2000 characters needed characters left
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