How to modify a line of code in a core plugin?

I’m looking to modify a single line of c++ code in the OnlineSubsystemSteam plugin, but I’m not sure how to proceed or what’s required in order to compile the changes and make sure they’re incorporated into my project. If anyone could provide me with directions on how I might do this it would be greatly appreciated!

You will need to “fork” something.

Either you can git clone the entire Unreal project, then make the change, then build the editor/engine from that fork, and use that for making your game. Many big games/studios do this, but it makes pulling fixes from newer versions hard.

Or you can do a “copy fork” of the plugin in question, starting at the plugin directory with build files, and down. Give it a new name, in the build configs and top class name. (CustomSteamOnlineSubsystem, or whatever.) Then add this as a plugin to your regular project, build it, and add this plugin as a dependency on your main project, and remove the dependency on the upstream “engine” one.

The benefit of the second option is that you only need to worry about pulling in fixes to the plugin; the rest of the engine can still be updated as normal. The draw-back is that “your” code is now partially owned by EPIC – that plugin, which you copied, is now unreal engine code, not code written by you. Often, this isn’t a problem at all, but at some point in the future, someone might want to buy the code from you, and you can’t legally sell the copied code. You can sell the built binaries, as a game – just not the actual source code you copied. And for 80% of successful projects, and 99.8% of all projects, this doesn’t really matter. And if your project IS successful, and you DO want to sell the code, there are ways to get where you need to go, such as selling a “patch file” that the buyer can apply to their copy of the same source code – it just makes the business/transfer path a little more squirrely. (And not actually following the legalities, can be a real problem, so I wouldn’t recommend taking the “nobody will know/notice” stance, if you get that far!)

2 Likes

I’m guessing you’ve already done this, but in case anyone else has questions about this - there are a couple of lines in your projects build.cs file that need to be uncommented too.