closes the active Unity scene.
CloseUnityScene["name"]
closes the Unity scene with the specified name.
CloseUnityScene[patt]
closes the Unity scene with the name matching the string pattern patt.
CloseUnityScene[RegularExpression["regex"]]
closes the Unity scene with the name matching the specified regular expression.
CloseUnityScene[…,n]
closes at most n Unity scenes.


CloseUnityScene
closes the active Unity scene.
CloseUnityScene["name"]
closes the Unity scene with the specified name.
CloseUnityScene[patt]
closes the Unity scene with the name matching the string pattern patt.
CloseUnityScene[RegularExpression["regex"]]
closes the Unity scene with the name matching the specified regular expression.
CloseUnityScene[…,n]
closes at most n Unity scenes.
Details and Options
- If the active scene is closed, then the first open scene in the Hierarchy window will become the active scene. If there are no more open scenes, then a new default scene will be created and become the active scene.
- CloseUnityScene[expr] closes the first open Unity scene it finds.
- CloseUnityScene[expr,n] closes at most n scenes.
- CloseUnityScene[expr,All] closes all matching scenes.
- CloseUnityScene[All] closes all open scenes.
- CloseUnityScene is Listable.
Examples
Basic Examples (2)
Close a scene using a string pattern:
Use abbreviated string patterns:
Close multiple scenes using a string pattern:
Close multiple scenes using a RegularExpression:
Related Guides
-
▪
- Scenes
Text
Wolfram Research (2019), CloseUnityScene, Wolfram Language function, https://reference.wolfram.com/language/UnityLink/ref/CloseUnityScene.html.
CMS
Wolfram Language. 2019. "CloseUnityScene." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/UnityLink/ref/CloseUnityScene.html.
APA
Wolfram Language. (2019). CloseUnityScene. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/UnityLink/ref/CloseUnityScene.html
BibTeX
@misc{reference.wolfram_2025_closeunityscene, author="Wolfram Research", title="{CloseUnityScene}", year="2019", howpublished="\url{https://reference.wolfram.com/language/UnityLink/ref/CloseUnityScene.html}", note=[Accessed: 16-August-2025]}
BibLaTeX
@online{reference.wolfram_2025_closeunityscene, organization={Wolfram Research}, title={CloseUnityScene}, year={2019}, url={https://reference.wolfram.com/language/UnityLink/ref/CloseUnityScene.html}, note=[Accessed: 16-August-2025]}