Like for any other Unity project, you’ll need a Camera (or more) in your level to see the action. The TopDown Engine includes a few Camera specific scripts. Note that you can use any Camera script with the asset, or implement your own, or build on top of the provided scripts. There’s nothing mandatory here and you can do whatever you want. This page covers the main scripts and how to use them.
Regular and UI Cameras
By default, in most demo scenes of the TopDown Engine, you’ll notice a camera rig : a transform holding a regular camera (2D, 3D, following the player or not, etc) and a UI Camera. The UI Camera’s Culling Mask is set on UI, which means it’ll only render UI tagged stuff, and is setup to be superimposed over the main camera’s render. It contains one or more canvases, and on them you’ll find buttons, screens, etc. The MainCamera is a regular Unity camera, and in most demos the engine uses Unity’s amazing Cinemachine to drive it.
The engine relies on Cinemachine to handle cameras base behaviour. It’s a beautiful and powerful tool, that should cover all your needs when it comes to camera movement and behaviour. This documentation doesn’t cover how to use Cinemachine, as its own documentation does that perfectly well.
The only specifics to the TopDownEngine are these components, added to the virtual camera :
- the use of a Cinemachine Confiner, automatically set to the LevelManager’s bounds on start, so you don’t have to worry about it.
- an MMCinemachineCameraShaker, used to catch camera shake events and move the virtual camera around in shake patterns.
- a CinemachineCameraController, a minimal class that allows you to turn following on or off
For 2D scenes where you want pixel perfect behaviour from the camera, the engine relies on Unity’s native Pixel Perfect Camera component to provide crisp visuals. Check out its documentation for more details on how to use it. You can also see it in use in the Koala Dungeon demo scene.
The TopDown Engine relies on Unity’s excellent PostProcessing stack for post processing effects. Don’t hesitate to check its documentation for more info on how to take full advantage of it.