7. Export and next steps
The game runs in the editor. This last part turns it into something you can send to someone.
Name it
Open File > Project Settings... > General. Name is what the game is called and Version is the version the exported game carries. You can pick an Icon too: a square PNG of 512 or 1024 pixels in the project.
Export
- Save the scene. An export takes what is on disk.
- Open File > Export....
- Type a folder outside the project in Output folder and press Export.
On macOS the result is My First Game.app. On Windows and Linux it is a folder with the game's program and one file, Game.cairnpak, that holds every file of the project.
The exported game has no editor in it. It is the engine's runtime program under your game's name. Double-click it and the game starts in the scene you set as the start scene.
Exporting a game has the details, including what a downloaded game does on macOS when it is not signed.
What you built
Look back at the pieces, because every game in this engine is made of the same ones:
- Entities with components: a Mesh Renderer to draw, a collider to be solid, a Rigidbody to move, a Character Controller to walk.
- Scripts that the engine calls:
OnStart,OnUpdate,OnTriggerEnter. - Fields that connect scripts to numbers, entities and scenes through the inspector.
- Prefabs for things that exist many times.
- Events for scripts that should not know about each other.
- Scenes for levels, and a persistent entity for what outlives them.
Ideas to try
Each of these is a small step from what you have.
- A jump sound. Import a
.wavby dragging it into the Assets panel. AddJumpSound = Field.Audio()to the player's fields and callAudio.PlayOneShot(self.JumpSound)whenJumpreturns true. See Audio. - Sparkles. Make a prefab with a Particle System and spawn it where a coin was:
Scene.Instantiate(self.Sparkle, self.Entity.WorldPosition). - A moving platform. A cube with a Box Collider and a Kinematic Rigidbody, moved by
Tween.To(self.Entity, "Position", Vec3(0, 3, 0), 2)in a loop. - A timer. Add
self.Time = self.Time + deltaTimeto the game script'sOnUpdateand show it in a second label. - A best time that is kept.
SaveData.Save("Best", { Time = self.Time })writes it, andSaveData.Load("Best")reads it back the next time the game runs. See Saved games. - A real character. Import a rigged model and drive its animations from the player's speed. See Animation.
Where to read on
- Learn Lua if the scripts were your first.
- Scripting overview for everything a script can do, and Recipes for common pieces.
- The editor for every panel and shortcut.
- The other two templates in the project hub, Third person and Top-down shooter, are larger games built the same way. Read their scripts.