Skip to content

Commit c8e2a11

Browse files
kennytannEvergreen
authored andcommitted
[UUM-116587][UUM-116583][6000.4][URP 2D] Fix Light 2D name on game object creation
1 parent 36b89ce commit c8e2a11

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

Packages/com.unity.render-pipelines.universal/Editor/2D/LightBatchingDebugger/LightBatchingDebugger.cs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ private void ViewBatch(int index)
162162

163163
foreach (var obj in batch1.Lights)
164164
{
165-
if(obj != null)
165+
if (obj != null)
166166
lightBubble1.Add(MakePill(obj));
167167
}
168168

@@ -241,7 +241,7 @@ private void CompareBatch(int index1, int index2)
241241
lightBubble1.Clear();
242242
foreach (var obj in lightSet1)
243243
{
244-
if(obj != null)
244+
if (obj != null)
245245
lightBubble1.Add(MakePill(obj));
246246
}
247247

@@ -255,7 +255,7 @@ private void CompareBatch(int index1, int index2)
255255
lightBubble2.Clear();
256256
foreach (var obj in lightSet2)
257257
{
258-
if(obj != null)
258+
if (obj != null)
259259
lightBubble2.Add(MakePill(obj));
260260
}
261261

@@ -391,7 +391,7 @@ private void OnSelectionChanged()
391391
var firstIndex = batchListView.selectedIndices.First();
392392
var secondIndex = batchListView.selectedIndices.Last();
393393

394-
if(secondIndex > firstIndex + 1 || secondIndex < firstIndex - 1)
394+
if (secondIndex > firstIndex + 1 || secondIndex < firstIndex - 1)
395395
{
396396
// Clamp since we do adjacent batch comparisons
397397
secondIndex = Mathf.Clamp(secondIndex, firstIndex - 1, firstIndex + 1);
@@ -408,7 +408,7 @@ private void OnSelectionChanged()
408408

409409
default:
410410
// Account for multiple select either with shift or ctrl keys
411-
if(batchListView.selectedIndices.Count() > 2)
411+
if (batchListView.selectedIndices.Count() > 2)
412412
{
413413
if (selectedIndices.Count == 1)
414414
{
@@ -466,8 +466,12 @@ private bool IsDirty()
466466
isDirty |= Light2DManager.GetCachedSortingLayer().Count() != batchList.Sum(x => x.LayerNames.Count());
467467
isDirty |= cachedSceneHandle != SceneManager.GetActiveScene().handle;
468468
isDirty |= cachedCamPos != Camera.main?.transform.position;
469-
isDirty |= totalLightCount != lightCullResult.visibleLights.Count();
470-
isDirty |= totalShadowCount != lightCullResult.visibleShadows.Count();
469+
470+
if (lightCullResult.IsGameView())
471+
{
472+
isDirty |= totalLightCount != lightCullResult.visibleLights.Count();
473+
isDirty |= totalShadowCount != lightCullResult.visibleShadows.Count();
474+
}
471475

472476
return isDirty;
473477
}

Packages/com.unity.render-pipelines.universal/Editor/2D/Renderer2DMenus.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ internal static void Place(GameObject go, GameObject parent)
101101

102102
static Light2D CreateLight(MenuCommand menuCommand, Light2D.LightType type, Vector3[] shapePath = null)
103103
{
104-
GameObject go = ObjectFactory.CreateGameObject("Light 2D", typeof(Light2D));
104+
var lightName = type != Light2D.LightType.Point ? type.ToString() : "Spot";
105+
GameObject go = ObjectFactory.CreateGameObject(lightName + " Light 2D", typeof(Light2D));
105106
Light2D light2D = go.GetComponent<Light2D>();
106107
light2D.batchSlotIndex = LightBatch.batchSlotIndex;
107108
light2D.lightType = type;

0 commit comments

Comments
 (0)