-
Notifications
You must be signed in to change notification settings - Fork 2k
Creating a new playable scene
If you want to create a new location for the game, a good place to start is the scene _EmptyLocation, found in /Scenes/Locations/
.
To create a location completely from scratch instead and be able to play in it, you need to provide a few fundamental Prefabs. They are all located in the folder /Prefabs/Gameplay/
.
-
Add the EditorInitializer Prefab
The script on this Prefab (EditorColdStartup component) loads the necessary "manager" scenes to make the game playable and to allow the player character to move between Locations. If this Prefab is missing, the player character will not be spawned when pressing Play.
Important: This script needs to reference a ScriptableObject of typeSceneData
to work. This is what tells the loading system what scene the game is starting from. Create one (preferably in the folder/ScriptableObjects/SceneData/
) and make sure its Scene Type property is set to Location, then reference the correct scene file in it. Finally, reference this newly created ScriptableObject into the EditorColdStartup component, in the property This Scene SO. -
Add the CameraSystem Prefab
This Prefab contains the Camera (which includes the CinemachineBrain component) and the main Cinemachine virtual camera, a FreeLook, which follows the player character during gameplay. The FreeLook initially contains a dummy target, which is swapped dynamically with the player character when the game enters Play Mode.
If present, remove the default Camera GameObject. -
Add the SpawnSystem Prefab
This Prefab takes care of spawning the player. In a normal game situation, it would spawn it in a specific position (entry point) depending on which scene the player is coming from. When testing individual scenes, it will spawn it in a default location (see children GameObjects). -
Add some geometry to walk on
Add a plane, or any geometry that the character can walk on. Ensure it has a collider (any), and that the default spawn location GameObject (in the SpawnSystem Prefab) is placed above it. -
Press Play
Unity Open Projects - Open-source games made by Unity + the community
We are looking forward to see what you will create ❤
- the Unity Creator Advocacy team
- Game architecture overview
- Playing the game in Unity
- Creating a new playable scene
- Building the game
The game systems explained, with API examples. For programmers.
- Event system
- State machine
- Input
- Object pooling
- Runtime anchors
- Audio system
- Narrative
- Dialogue system
- Cutscenes system
- Inventory and Cooking
- Combat
- User Interface
How-tos for designers to expand the game's gameplay.
- Adding quests
- Adding items
- Creating dialogues
- Making a cutscene