How to create a Theme - Unity-Technologies/EndlessRunnerSampleGame GitHub Wiki
Themes being asset bundles, please have a look at the Asset Bundles page first.
Adding a new Theme
The Assets/Bundles/Themes folder contain folders with the 2 builtin themes (Day and Night) for reference.
We start by creating a new ThemeData file somewhere in the project (a new folder in the Bundle/Themes is probably the best way to keep it coherent)
Right click where we want to create it, and in the menu that appear we select Create > Thrash Dash > Theme Data
NOTE : it is important to call that file themeData otherwise the bundle loader won't find it
We add it to a new asset bundle. At the bottom of the inspector, in the AssetBundle drop down, we choose New...
and enter a name like theme/MyThemeName
. Be sure to start the name with theme/, or the database manager won't recognise it as a theme
We can now fill all the data for our theme : name, cost, premium cost, give it an icon (see existing one like DayPreview or NightPreview for format)
Let's now dive deeper into the other part of the data of a theme
Zones
Zones is where we define the track piece that will be spawned randomly by the game. The length is how many unity (meters) the game will pick track segment from that zone before getting to the next zone. Once the game reach the last zone, it loop back to the first zone.
E.g. : If the game have 3 zones of 500 units each, the game will choose randomly track segments from the first zone for the first 500 units. Then start choosing segments from the second zone for the next 500 units, and finally segments from the last zone for 500 units before going back to choosing segments from the first and so on.
Each zone contain a list of prefabs containing a TrackSegement
scripts (See the Track page for how TrackSegmeent work and how to make new one)
Collectible Prefab And Premium Collectible Prefab
Those prefabs are the objects that the player will collects for in game & premium currency (the default one being the fishbones and anchovies).
Note that the default ones use a shader called CurvedRotation, see the Optimizations page for more info on that
Decorations
Decorations are prefabs that will be used to decorate the level.
- All the clouds values are used to spawn and spread the cloud being moved with a parallax scrolling.
- The Sky Mesh is a reference to the mesh that is used as the "skybox".
- The UI Ground mesh is the mesh used as Background in the Loadout screen before a run
- The Fog Color is the color of the fog used to hide the track segments appearing in the distance. We should try to match it to the Sky Mesh color so it blend properly.
Shaders
All objects (track pieces, obstacles etc.) should use the Unlit/CurvedUnlit
shader so that the "curved world" effect work. Similarly, collectibles should used CurvedRotation. See the Shaders page for more information on shaders