Jump to content

Removing deleted Terrain Scenes from Builds


DKnight

Recommended Posts

This script will clean up the build settings. If you like me, and create a few multi terrains. You go in and remove some of Gaia User Data directories by deleting sessions directories. You will see grey out terrain scenes in your build settings. Well this script will clear those grey scenes from the build settings.

This script belongs in a Editor directory;

 

using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using UnityEditor;
using UnityEngine;

public class EditorBuildSettingsTools : MonoBehaviour
{
    [MenuItem("Tools/RemoveDeletedScenes")]
    public static void CleanUpDeletedScenes()
    {
        var currentScenes = EditorBuildSettings.scenes;
        var filteredScenes = currentScenes.Where(ebss => File.Exists(ebss.path)).ToArray();
        EditorBuildSettings.scenes = filteredScenes;
    }
}

 

Edited by DKnight
  • Like 4
Link to comment
Share on other sites

  • DKnight changed the title to Removing deleted Terrain Scenes from Builds
  • Tell a friend

    Love Canopy - Procedural Worlds? Tell a friend!
  • Need help?

    We work with some of the biggest brands in global gaming, automotive, technology, and government to create environments, games, simulations, and product launches for desktop, mobile, and VR.

    Our unique expertise and technology enable us to deliver solutions that look and run better at a fraction of the time and cost of a typical project.

    Check out some of our non-NDA work in the Gallery, and then Contact Us to accelerate your next project!

×
×
  • Create New...