Add new light rails and prefabs

This commit is contained in:
Toomas Tamm
2021-01-24 17:16:33 +02:00
parent d52c87eeaa
commit faf1e41795
171 changed files with 3429 additions and 23388 deletions

View File

@@ -0,0 +1,45 @@
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
public static class LightProbeGroupMerger
{
const string MergedLightProbeGroupName = "MergedLightProbeGroup";
[MenuItem("Tools/Lights/Merge Light Probe Groups")]
static void MergeLightProbeGroups()
{
var lightProbeGroups = GameObject.FindObjectsOfType<LightProbeGroup>();
if (lightProbeGroups.Length > 1)
{
// Collect light probe positions from all light probe groups in the scene.
var mergedLightProbePositions = new List<Vector3>();
foreach (var lightProbeGroup in lightProbeGroups)
{
foreach (var lightProbePosition in lightProbeGroup.probePositions)
{
mergedLightProbePositions.Add(lightProbeGroup.transform.TransformPoint(lightProbePosition));
}
}
// Create a new light probe group that merges all the light probe positions.
var newGameObject = new GameObject(MergedLightProbeGroupName);
Undo.RegisterCreatedObjectUndo(newGameObject, $"Created {MergedLightProbeGroupName}");
var mergedLightProbeGroup = newGameObject.AddComponent<LightProbeGroup>();
mergedLightProbeGroup.probePositions = mergedLightProbePositions.ToArray();
// Destroy the old individual light probe groups.
foreach (var lightProbeGroup in lightProbeGroups)
{
if (lightProbeGroup != null && lightProbeGroup.gameObject != null)
{
Undo.DestroyObjectImmediate(lightProbeGroup.gameObject);
}
}
Debug.Log($"Merged {mergedLightProbePositions.Count} light probes from {lightProbeGroups.Length} light probe groups into '{MergedLightProbeGroupName}'.");
Selection.activeObject = newGameObject;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1f5f66e519226be4a8b6732f4c24b3e5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: