- Home /
Copy a scene with editor script?
So i have this sort of template called Basic.unity, i want to have a editor script that can duplicate this scene and all of its contents and prefab connections to a new scene that has a number as a scene name, ex. 1.unity, 2.unity, etc.
Any ideas on how i can do this, instead of copying the one scene 100s of times on a mac??
Answer by Ash-Blue · Nov 30, 2016 at 06:03 AM
No reason to use System.IO
. Looks like Unity now has a built-in method for copying assets safely.
using UnityEngine;
using UnityEditor;
public class CopyFile : MonoBehaviour
{
[MenuItem( "Example/Copy Something" )]
static void CopySomething( )
{
FileUtil.CopyFileOrDirectory( "sourcepath/YourFileOrFolder", "destpath/YourFileOrFolder" );
}
}
SRC: https://docs.unity3d.com/ScriptReference/FileUtil.CopyFileOrDirectory.html
Answer by AlucardJay · May 21, 2014 at 10:43 PM
For Windows, click on the scene in the project window and press Ctrl and D to duplicate.
i want to have a editor script that can duplicate this scene and all of its contents and prefab connections to a new scene that has a number as a scene name, ex. 1.unity, 2.unity, etc.
Your answer
Follow this Question
Related Questions
Object reference not set to an instance of an object. 1 Answer
How can I switch back to 1st-person-cam mode in Scene? (right-click + Arrows) 2 Answers
lost my tabs my heirarchy, game and scene tab 1 Answer
How to set a game-over scene when an object hits another? 0 Answers
When to create a new scene? 1 Answer