Methodical 2.0.0 Documentation
Methodical is an interactive C# interpreter for Unity. It integrates Microsoft’s open-source compiler platform into Unity, enabling real-time in-editor scripting with full language support and autocomplete. The Methodical interpreter’s uses range widely, from testing methods on objects to full editor automation and scene processing.
Methodical also comes with an upgraded inspector. View and change all variables on an object, even if they are private, properties, or otherwise non-serialized. You can also view all functions on an object and call them from a handy UI.
Microsoft’s compiler platform is not compatible with some assets on the asset store. Click here for more information.
The Methodical Interpreter
The Methodical Interpreter enables you to do interactive C# scripting. To open the interpreter, go to:
Window -> General -> Methodical
The Methodical Interpreter Window
The components of the Methodical Console window are as follows:
- Command Entry – Enter your C# commands here. As you type, Methodical will provide autocomplete and other suggestions.
- Console Log – Methodical prints the output of your commands in this area
- Command Entry Popout – Click here to pop out the Command Entry field into another window, enabling multi-line scripting. See the Methodical Scratchpad section for more information
- Submit Button – Submits code written the Command Entry field. This is also mapped to the Return key
- Clear Button – This clears all previous commands and stored variables
- Expand Variables Pane – this button extends the Variables Pane – see The Variables Pane for more information
The Variables Pane
The Variables Pane shows any variables that have been created during the session. The components of the Variables Pane are as follows:
- Special Variables – The “selection” variable is a special variable that is reserved during an interpreter session. It provides a shortcut for accessing selected objects in the editor. If multiple objects are selected, it appears as an Object array. If a single object is selected, the variable presents as that object’s type. If no objects are selected, the variable does not appear at all.
- Close Variables Pane – this button hides the Variables Pane
- Clear Button – This button clears all variables from the session
- Variables List – This area lists all the variables that have been created during this session. Variables may also be deleted here
Extended Inspector
Methodical extends the Unity inspector to provide quick access to all variables and functions on a selected object. To open the interpreter, go to:
Window -> General -> Methodical Inspector
Navigating the Inspector
Variables View
The Variables View shows all variables on a selected object’s components, regardless of their accessibility or serialization. Their values can be changed here. Some variables will be greyed-out – these variables are properties with no set function and therefore cannot be written to. Also note, non-serialized variables will likely have their values reset on play or editor close. These variables are called out in the inspector.
A word of warning – this view exposes both internally and externally accessible variables. Be sure you know what a non-public variable does before tweaking it, it may be non-public for a reason!
Functions View
The Functions View enables you to call public and private functions on a selected object’s components through a handy interface.
Calling a function
- Click on the method title in the Functions tab. The Function’s interface will appear:
The Function’s interface can also be popped out using the ^ button
- Expand the particular function definition you’d like to call:
- Enter values for the function’s parameters and press the Run button to execute