How to change private source function to public?

My project requires me to use sequence recorder in game and blueprint. However, functions inside SequenceRecorderBlueprintLibrary.h are private. Thus, although I can use it in the editor, I get a warning and the project cannot be packaged successfully. Thus I choose to change the engine source code and tried to make the function public. Below is what I 've done. I simply just add ‘public’ at the header file of SequenceRecorderBlueprintLibrary.h . My engine build and the editor open correctly. I stop getting warning from editor when I compile my code. However, my project cannot be packaged correctly.

These are my output message when I try to package my project.
[2016.09.13-20.49.56:193][ 0]LogWindows:Error: === Critical error: ===
[2016.09.13-20.49.56:193][ 0]LogWindows:Error:
[2016.09.13-20.49.56:193][ 0]LogWindows:Error: Assertion failed: !DependencyIndex.IsNull() [File:D:\Sources\UE4\Engine\Source\Runtime\CoreUObject\Private\UObject\SavePackage.cpp] [Line: 4366]
[2016.09.13-20.49.56:193][ 0]LogWindows:Error: Failed to find dependency index for SequenceRecorderBlueprintLibrary /Script/SequenceRecorder.Default__SequenceRecorderBlueprintLibrary (Function /Game/FirstPersonBP/Blueprints/FirstPersonCharacter.FirstPersonCharacter_C:ExecuteUbergraph_FirstPersonCharacter)
[2016.09.13-20.49.56:194][ 0]LogWindows:Error:
[2016.09.13-20.49.56:194][ 0]LogWindows:Error:
[2016.09.13-20.49.56:194][ 0]LogWindows:Error:
[2016.09.13-20.49.56:194][ 0]LogWindows:Error: end: stack for UAT
[2016.09.13-20.49.56:194][ 0]LogExit: Executing StaticShutdownAfterError
[2016.09.13-20.49.56:196][ 0]LogWindows: FPlatformMisc::RequestExit(1)

Blueprint library classes are not meant to be used from C++. They are intended as Blueprint wrappers for functions that are only accessible via C++. You are trying to call from C++ into the BP library, which then calls back into C++. I hope you see that this doesn’t make much sense.

What you should do instead is to directly use the C++ APIs that the Engine exposes (and which the BP function library only wraps). The best way to figure out how to do this is to simply look at the implementation of the BP function library and see how it gets its work done.

For example, instead of calling USequenceRecorderBlueprintLibrary::StopRecordingSequence() you’d call FSequenceRecorder::Get().StopRecording();. The latter is considered the C++ Engine API.

I want to use sequence recording function inside blueprint. I can’t use C++ API inside blueprint directly. I also tried to add new public blueprint functions inside SequenceRecorderBlueprintLibrary but the project still cannot be packaged.

Should I create a new .h and .cpp in source folder and use FSequenceRecorder function ?

I am trying to modify c++ source code so I can use Sequence Recorder inside Unreal editor and make a successful project package.

I change functions inside SequenceRecorderBlueprintLibary.h and I can now use it as public functions inside blueprint. It works fine in Unreal Editor. At first I tried to package my project but I encounter an error during packaging.

Error: Failed to find dependency index for SequenceRecorderBlueprintLibrary

I then go into savePackage.cpp and disable checkf(!DependencyIndex.IsNull() …). The code I modified is below.

After disabling that line, I can package my project successfully. However, when I launch the .exe, the program does not start sequence recording correctly. Is it because I tried to use Sequence Recorder outside of Unreal Editor? Are there ways to use Sequence Recorder outside of Unreal Editor

I found out that the reason why I cannot use sequence recorder in game package is that source code of Sequence Recorder is stored in the editor folder. The package system of Unreal may only package functions and classes inside engine code, not including editor code. Are there ways to package editor code during packaging?

No, and it’s against the EULA. You cannot use Editor code in your games, sorry. SequenceRecorder is an Editor feature. It depends on a number of other Editor modules.