---
title: Script window reference
product: Unity Spark
canonical: https://docs.unity.com/en-us/unity-spark/create/build/scripts/script-window-reference
last_updated: 2026-12-01
generated_at: 2026-12-01T21:01:42.308Z
locale: en-us
---

# 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.

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](/unity-spark/create/assets/manage/project-window-reference.md).
* Select a script in the **Project** window, then select **Open** in the [Inspector window](/unity-spark/create/build/components/inspector-window-reference.md).

For instructions, refer to [Write and attach scripts](/unity-spark/create/build/scripts/write-scripts.md).

## 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 `<agent name> is writing <script name>`, and then `<agent name> wrote <script name>` when it finishes. |
| **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](/unity-spark/create/assistant/about-assistant.md) rewrites a script that has unsaved changes, a bar appears at the top of the editor. The bar displays the message `<agent name> rewrote this script. Your unsaved edits are still here.` and contains the following buttons.

| **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 `No script open.` Select **Create New Script** to start a new script from the default template.

## 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, `<number> more` follows it. Hover over or focus the message to display the full numbered list of errors.                                                                                        |
| Save state    | Shows one word about the script's state, such as `unsaved` when the script has unsaved changes, or `Saved` after a successful save. After a save that reports errors, it reads `Saved with <number> error(s)`. If a save fails, it displays the reason. |
| **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**.                                                       |

## Additional resources

* [Introduction to scripts in Unity Spark](/unity-spark/create/build/scripts/about-scripts.md)
* [Write and attach scripts](/unity-spark/create/build/scripts/write-scripts.md)
* [Console window reference](/unity-spark/create/test-debug/console-window-reference.md)
* [Unity Spark windows reference](/unity-spark/create/workspace/ui/windows-reference.md)
