Here we'll go through the workflow of creating a simple Job, add and setup Steps and run everything.
For this tutorial, we'll create a Job that prints all scene paths inside of
Creating a Job file
- In project window, right-click and go to
Create > RockTomate > Job.
An asset file will be created with an extension of
rock.job.asset (in Unity it will show up as
rock.job). While the extension doesn't do much, it's recommended to keep it to make searching easier.
- Double-click a newly created job and it will open in Job Editor Window. The window will open if it's closed or will be focused on if hidden in a different tab.
For what we're trying to achieve, we would need the following steps:
- Loop - iterating through any collection item (List, Array etc.)
- Print Log - prints any object in a Unity console.
- In Step Browser Window, locate and double-click on
Loopstep to add it to the job.
- Locate Print Log and drag it on top of the loop. Loop step is a special step which accepts child steps.
If everything is done right, this is how your Job should look like.
To access steps' properties, simply click on it in the Job Editor Window. Your Inspector Window (unless it's closed) will show Step properties.
This field only accepts formulas. Formulas should return a value which could be equivalent to a collection. If resultant value is not an array, it will be converted to one. (see Type Conversion section to know more)
path macro which requires two arguments: a path containing a wildcard and whether or not to convert paths to be relative to the
- [Argument 1] We want to iterate through the whole
Assetsdirectory, so we'll use a root variable
%AssetsDir%to get it. Then we add
/*.unityto indicate that we want all file paths with
.unityextension in that directory.
- [Argument 2] We'll want to convert it so we'll set it to
This is our final formula:
The name of the temporal variable that will be created inside of the
Loop step. This variable represents an array item. Let's set it to
path. Note that this variable will not be available outside of
Print Log Step
Enable formula mode for this field, and put our local variable that we renamed earlier:
We're done! Now press the play button at the top and your Unity Console Window should be filled up with scene paths.
This Job could easily be re-purposed for doing more than printing Unity scenes. For example, we could open each Unity scene, bake lightmaps, then open another scene and repeat.
More importantly, this will scale as you add more scenes into the project as the macro will get all unity scenes.