Trying to redirect back to the topic...
On 5/6/2019 at 8:34 PM, TheRealSmolt said:
In Unity, the engine and the game are the same program, with the game window inside and in a different project. I don't know how to achieve this.
You can start where they did, which is with a plugin architecture.
Conceptually --- and potentially actually done as an implementation --- they follow this model:
The engine provides a bunch of functionality, loads a plugin designated as the primary plugin, then spins in a loop running the main plugin. When you start the editor you are starting the engine with your editor as the primary plugin. When you run your game you are starting the engine with your own library as the primary plugin.
The game editor is basically a plugin for the engine that includes editing functionality. It tells the engine to display the menus, game resources, object inspector, and similar pieces. The plugin also includes details for how to launch a compiler, how to load a secondary plugin, and how to execute that secondary plugin in addition to itself. Usually they load several more plugins for additional functionality like profiling or networking tools, whatever they need as part of the editor suite.
Your game is a second plugin. When it is loaded as the primary plugin it runs as you expect your game to run.
You can also write additional plugins, and many online resources exist as plugins. Some games include many additional plugins. They are compiled and added to the program as secondary plugins, and your code or the editor's code can run them. VR plugins are a great example, they are generally separate modules that register to provide additional functionality for the editor program, and also can be used by your code.
The implementation details are somewhat different between Unity and Unreal. With unreal you can see the source, open the editor project and see all the things it is doing. It can be overwhelming to look at for beginners, and daunting for those with intermediate experience. In Unity you can't see the source unless you're at a company that pays for it, so the conceptual model will need to be enough.
Some games mentioned above have the editor parts permanently included with the engine parts. There are several ways to implement that, but that's not the model being asked about when referencing Unity and Unreal.