Creating a scene with GameObjects and saving them

Sorry this is a newbie question…

I am going to try to remake a game for which I have the original level map files which I know the byte format for and how to convert the hex data into objects that I need.

I know I can create the levels on the fly/run time using a script but what I would like to do if possible is make a script that creates a scene for each level using prefab assets so it gives me the layout of the level and save it to a scene, giving me my level template I can then manually add in all my lighting navmesh etc…

Is this possible?

Yep, editorscripting should be able to handle it
You’ll need a combo of the following

File.ReadAllBytes(String) Method (System.IO) | Microsoft Learn to read the byte array, which you then iterate over
Unity - Scripting API: EditorGUI.ObjectField To get references to your prefabs (or hard-code some assetdatabase.Load’s)
Unity - Scripting API: EditorApplication.SaveScene To save a scene once you reach the end of a level in the byte array, then
Unity - Scripting API: EditorApplication.NewScene to start a new scene

Thanks hpjohn, that’s perfect :slight_smile: