0 votes
by (8.2k points)
edited by
Why is it recommended to Change the Sample Scene name in Unity?

I'm a beginner so I have no idea. If you can, how? Also, does the scene name matter when the game is completed and you build it?

1 Answer

0 votes
by (8.2k points)
edited by

The Scene.name returns a run-time, read-only, string value. The name limits to 244 characters. The Scene name defaults to scene. The user changes the name during game creation.

The following script example changes the Scene depending on GUI.Button clicks and the name of the Scene. To make this example work:
  1. Create a Project with two Scenes, scene1 and scene2.
  2. Attach the script below to a GameObject added to scene1.
  3. Attach the same script to a GameObject added to scene2.
  4. Click on the GameObject and go to the Inspector.
  5. In the My First Scene field and My Second Scene fields, enter the names of the Scenes you would like to switch between, scene1 and scene2.
  6. Select scene1 by double-clicking it in the Project, and press Play. The scene1 scene will appear.
  7. Click the Load Next Scene button and scene2 will be loaded.

SampleScene in unity is the default name so it may create problems if we import other package scenes with the same name in unity projects. It is a good practice to change the name from "SampleScene" to your custome name.

You can rename the scenes inside the Project/Assets/Scenes folder (instead of from inside the Hierarchy).

You should be able to click the scene once (in the editor), and then when you click it again, it should let you rename it. That said, I have had trouble renaming scenes and I'm not sure why. In those cases, File->Save As. This will save it as a new scene. Then you can delete the old one.

The scene name doesn't really matter, but having some kind of strategy and pattern to naming your scene can help when you get to the point of loading levels within your game

TechXR runs courses in AR / VR / Metaverse / Game Development. Some of the popular Q&A in our courses are available here for easy discovery.

113 questions

117 answers

58 comments

105k users

...