I created this tool called Piro
to help me display and visualize concepts better for my YouTube videos. Originally I wrote a similar code back there in Godot used an earlier pathfinding and parallel programming videos. I've since then ported the tool into Unity as a modernization process.
This tool is used to visualize new concepts, and is made available to anyone that wishes to tinker and run the visualizations themselves. My Video Repository can be found with a list of the scenes used for each video. Although the tool is new, there is no guarantee that each will is backwards compatible! To ensure that the cinematic can be run please use the version that matches the videos release date.
To use this tool first download Unity, this project current uses 2020.3.24f1
.
This tool uses C#
, you can look at the C# Docs for more in depth documentation. It also makes extensive use of the Coroutines to control the flow of Cutscene
and Cinematic
nodes.
Each video is broken up in terms of Cinematic
and Cutscene
classes.
Cinematic
is the root node of each scene and contains Cutscene
nodes as their children. A Cinematic
allow us to contain and cycle through each cutscene. By default, all Cutscene
nodes of a cinematic are set to non visible except the active cutscene.
Cutscene
nodes are direct children of the Cinematic
nodes and contain child nodes used to render and display. They have a function called Play
which allows them to change and manipulate the scene.
The main signal of StepBegan
allows us to control the flow of the cutscene by waiting for input until the user presses the next key Q
. How you rig the scene is completely up your preference however. I recommend the scene with the following node structure.
SceneRoot
- Camera
- EventSystem
- Canvas
- Cinematic
- Cutscene1
- Cutscene2
...
- CinematicControls
Please follow the Bubble Sort Scene as an example!
Lastly you'll need to hook up your cutscenes to the cinematic by dragging them into the slots on the cinematic node.
Below is an example of a standard Play
method.
public override async void Play()
{
yield return base.Play();
ListVisualSorts.waitTime = 0.1f;
List numbers = Enumerable.Range(1, 20).ToList();
ListVisualSorts.ShuffleNumbers(numbers);
bubbleListVisual.SetNumbers(numbers);
mergeListVisual.SetNumbers(new List(numbers));
quickListVisual.SetNumbers(new List(numbers));
OnStepEnded();
yield return new WaitForNextStep(this);
Coroutine bubble = StartCoroutine(ListVisualSorts.BubbleSort(bubbleListVisual));
Coroutine merge = StartCoroutine(ListVisualSorts.MergeSort(mergeListVisual, mergeHelperListVisual));
Coroutine quick = StartCoroutine(ListVisualSorts.QuickSort(quickListVisual));
yield return bubble;
yield return merge;
yield return quick;
OnStepEnded();
}
The cutscene controls offers a way of manging which scene is currently active as well as provides a legend for the controls. It's visibility can be toggled on/off by pressing
T
.
I use the plugin Unity Recorder to record the cutscenes generated from Piro.
If you see any error or would like to contribute to this repository feel free to send me a message and/or submit a pull request.
As of right now there are no plans to convert the PathFinding
video to use this newer library, please use Godot Video Tools to view older videos.
This uses the MIT license.