Files
chameleon/Assets/Scripts/Editor/SceneCollection.cs
T
admin e351336b39 Reorganize project folders and clean up editor tooling
Move editor scripts to Assets/Scripts/Editor (PlaySceneWindow, SceneCollection),
move DefaultNetworkPrefabs and the Main Camera custom blends asset into
Assets/Settings, and shelve the unused HeroCutout shader/include under
Assets/Unused. Rename the Chameleon background texture, delete the obsolete
DefaultParentForEditor script and New Lighting Settings asset, add a The Room
SceneCollection asset, and drop the redundant Assets menu entry from the
StraightenKnees tool.
2026-06-29 16:23:50 +02:00

43 lines
1.2 KiB
C#

using System.Collections.Generic;
using System.Linq;
using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEngine;
namespace Chameleon.Editor
{
[CreateAssetMenu(menuName = "Chameleon/Scene Collection (Editor)")]
public class SceneCollection : UnityEngine.ScriptableObject
{
public List<SceneAsset> sceneAssets = new();
[UnityEditor.Callbacks.OnOpenAsset]
public static bool OnOpenAsset(int instanceID, int _)
{
var @object = EditorUtility.EntityIdToObject(instanceID);
if (@object is SceneCollection sceneCollection)
sceneCollection.Open();
return false;
}
public void Open()
{
if (sceneAssets.Count == 0)
return;
OpenScene(sceneAssets.First(), OpenSceneMode.Single);
foreach (var sceneAsset in sceneAssets.Skip(1))
OpenScene(sceneAsset, OpenSceneMode.Additive);
}
static void OpenScene(SceneAsset sceneAsset, OpenSceneMode mode)
{
var scenePath = AssetDatabase.GetAssetPath(sceneAsset);
EditorSceneManager.OpenScene(scenePath, mode);
}
}
}