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++?

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