Script window reference
Find the tabs, editor, and save controls in the Unity Spark Script window to read and edit your project's Luau scripts.
Read time 3 minutesLast updated 3 hours ago
The Script window is a code editor for your project's Luau scripts. Each script you open appears in its own tab, with its own unsaved changes.
To open the Script window, do one of the following:
- Select Add window (+) in any window group and select Script.
- Double-click a script in the Project window.
- Select a script in the Project window, then select Open in the Inspector window.
For instructions, refer to Write and attach scripts.
Tab bar
The tab bar contains the following controls.
Control | Description |
|---|---|
| Script tabs | Shows one tab for each open script, labeled with the script's name. New scripts that you haven't saved yet show Untitled, then Untitled 2, Untitled 3, and further numbers in tab order. An indicator on a tab marks unsaved changes. |
| Close (X) | Closes the tab. If the script has unsaved changes, Unity Spark asks you to confirm with the Discard unsaved changes? dialog. Select Discard to close the tab and lose the changes. |
| Agent status | Appears while the assistant works on a script, and names the script it's working on, which might not be the script you have open. For example, the status reads |
| Open a script (+) | Displays a searchable list of your project's scripts. Select a script to open it in a new tab, or select New script to start a new unsaved script from the default template. If the script is already open, Unity Spark makes its tab active. |
Editor
The editor shows the active script's source with Luau syntax highlighting. Use it as follows:
- Edit the script directly in the editor. Shortly after you stop typing, Unity Spark checks the script for errors and underlines the lines that have errors.
- Press Ctrl+S (macOS: Cmd+S) to save the script. For a new script that you haven't saved yet, the shortcut opens the Save script as dialog.
If the AI assistant rewrites a script that has unsaved changes, a bar appears at the top of the editor. The bar displays the message and contains the following buttons.
<agent name> rewrote this script. Your unsaved edits are still here.Button | Description |
|---|---|
| Load <agent name>'s version | Replaces your unsaved changes with the assistant's version of the script. |
| Keep mine | Keeps your version in the editor. |
When no script is open, the window displays Select Create New Script to start a new script from the default template.
No script open.Status bar
The row under the editor has the following controls.
Control | Description |
|---|---|
| Error message | Shows the first error in the script. If there are more, |
| Save state | Shows one word about the script's state, such as |
| Revert | Discards your unsaved changes and restores the last saved version of the script. Available only for a saved script with unsaved changes. |
| Save As… | Saves the script under a new name. Opens the Save script as dialog. |
| Save | Saves your changes to the script. Available only for a saved script with unsaved changes. |
Save script as dialog
The Save script as dialog contains the following controls.
Control | Description |
|---|---|
| Script name | Sets the name of the script. If a script with that name already exists, the dialog displays an error and you can't save. |
| Cancel | Closes the dialog without saving. You can also press Esc. |
| Save | Saves the script under the new name. You can also press Enter. |