Skip to content

Instantly share code, notes, and snippets.

@mwegner
Created October 30, 2014 05:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mwegner/e44ab074279625e3f84a to your computer and use it in GitHub Desktop.
Save mwegner/e44ab074279625e3f84a to your computer and use it in GitHub Desktop.
Unity Re-Save All Scenes
using System;
using System.IO;
using UnityEngine;
using UnityEditor;
using System.Collections;
public class EditorSceneHelpers
{
[MenuItem("Aztez/Resave All Scenes")]
public static void ResaveScenes()
{
String[] allFiles = Directory.GetFiles(
Path.Combine(Application.dataPath, "Build Structure"), "*.unity", SearchOption.AllDirectories
);
for (int i=0; i<allFiles.Length; ++i)
{
allFiles[i] = "Assets" + allFiles[i].Replace(Application.dataPath, "");
}
foreach(var file in allFiles)
{
EditorApplication.OpenScene(file);
EditorApplication.SaveScene();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment