This is the finished project for my Intro to Creative Coding in Unity workshop. In the workshop, we explore many of these scripts together, line-by-line, to better understand what we're doing. Here the project is ready for dissection, and saved into multiple scenes so you can see the process. I recommend you start by trying out one of the builds so you can play with all the scenes.
This Google Doc May be handy for following along with the workshop.
Downloads: Windows App / Mac App
Then open the project in Unity and check out the Scenes in Assets/MMM/Trails/Scenes. I include some information about each scene below.
Use the keyboard to move around a cube with an attached Trail Renderer.
The movement is all controlled in the Move XY Script attached to the cube, and the visuals are provided by the Trail Renderer component on that same cube. The instructions all live in the UI Object.
Multiple Trail Renderers with Colors.
The cube was turned into a Prefab called BrushCube, and six copies were made and added to a container object called Brush. The Brush is moved using the Move XY Script from Scene 1. A Bloom effect has been added to the camera, this is part of the Unity Standard Assets. Try playing with the trail palettes by changing the colors of the Trail Renderer. You can shift-click to select all the cubes and change all their colors at once. Try it while the scene is running!
Symmetry and Screen Capture
Two components are added to the Main Camera - Symmetry, which enables horizontal mirroring effects with several blend modes, and Simple Grab, which captures screenshots of your scene to a specified folder. Try out all the blend modes and generate some screen captures. You can press the Space Bar to toggle the UI on and off thanks to the Group Toggle From Keyboard script on the UI>Group object.
Stay With the Action
A Camera Follow script has been added to the camera. This will keep the camera centered on a target object - in this case, the Brush container. Play with the Speed to see what it feels like, and change the Offset around while the scene is running. The 'Use Current Offset' property on the Camera Follow will set the offset on Scene Start based on the existing distance between the Camera and its Target.
Less is More
An update to Scene 4 using Cinemachine instead of a custom follower.
Adding a Background Image
A textured Quad is attached to the Camera to round out the look of our scene (photograph is Creative Commons CC-BY-SA Luca Galuzzi, please keep attribution if you use it). The Fill Screen script on the quad keeps the background filling the view of the camera, which has been switch to Orthographic view for this scene.