Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
2ef8887
HDRP: Rendering Debugger - "Freeze Camera For Culling" dropdown was o…
alex-vazquez-unity3d Mar 30, 2026
0392383
[UUM-108868] [URP] Fix GLES unsupported R32_SFloat RT format
Mar 30, 2026
c4e4136
Shader graph documentation feedback improvements - sprint 26 Mar
markg-unity Mar 30, 2026
4bd1833
Finalize GTF 9.0
ludeum Mar 30, 2026
160e6b1
Fix material debug not working
RemyUnity Mar 30, 2026
389f2da
[UUM-136415][6000.6][URP 2D] Add capture pass for recorder
kennytann Mar 30, 2026
d2b72df
GFXLIGHT-2046 : Make the roughness blur less dependent on resolution …
olivierprat Mar 31, 2026
5d0bae8
Reenabled cinemachine tests.
sim-bz Mar 31, 2026
d3b4d9c
[SGVFX][AI] Set Internals Visible from SGVFX to AI
Mar 31, 2026
0167610
Migrate UnifiedRayTracing Tests from Editor to Player tests
yvain-raeymaekers Mar 31, 2026
6bc59c3
[UUM-130481][Switch2] Clear UI overlay texture on base camera if crea…
kaychang-unity Apr 1, 2026
b2ecd1b
Fix URP Asset multi-select inspector bugs
arttu-peltonen Apr 1, 2026
d64a560
[UUM-138315] Silence FXC's annoying "potentially uninitialized variab…
yvain-raeymaekers Apr 1, 2026
1a758cd
Disable unstable SRP Foundation tests
AngelaDematte Apr 1, 2026
0a54b8e
Disable unstable Upscalers test
AngelaDematte Apr 1, 2026
7318660
Add missing ENABLE_TERRAIN_MODULE define to lighting assemblies
arttu-peltonen Apr 1, 2026
5a512ac
[VFX New Compiler] Plugging expressions and blocks
ludovic-theobald Apr 1, 2026
5730cbf
Better reprojection for URP SSR
pema99 Apr 1, 2026
087f14c
SRP: Replace BeginSample(string) and ProfilingSampler.Get() with inli…
alexey-zakharov Apr 2, 2026
eb3bd5b
[UUM-135644] Allow shader-build-settings-compatible enum keywords in …
april-roszkowski Apr 2, 2026
1dbdd5c
Remove GTF's dependency to the Test Protocol Package
ludeum Apr 2, 2026
d026e63
docg-8474: Remove screenshots
ocarrere Apr 2, 2026
50579ab
Added SubpassDepth support to URP shaders and RenderObjects feature
thomas-zeng Apr 3, 2026
49f6811
Fixed Default Volume profile bugs
kirill-titov-u Apr 3, 2026
9ff68e6
[VFX] Performance Tests Trimming
PaulDemeulenaere Apr 3, 2026
2aedb6e
DOCG-7573 - Shader Graph documentation for Custom Material Property D…
sebastienduverne Apr 3, 2026
1f99c11
Document variable rate shading
anjalin14 Apr 6, 2026
b3af078
Add UV scaling and offset support for Quad View in XR rendering
qgu-unity Apr 7, 2026
24b8ee7
Updated `DiffusionProfileList` to work with CoreCLR
jrs-unity Apr 7, 2026
d4309b0
Updated `BilateralUpsample` to work with CoreCLR
jrs-unity Apr 7, 2026
2818e62
Updated `EyeCausticLUTGen` to work with CoreCRL
jrs-unity Apr 7, 2026
9928e19
Updated `Hammersley` to work with CoreCLR
jrs-unity Apr 7, 2026
754eeb1
Updated `Decal` and `DecalSystem` to work with CoreCLR
jrs-unity Apr 7, 2026
eb1e01c
Updated `CompositionManager` and `CompositorCameraRegistery` to work …
jrs-unity Apr 7, 2026
f4a7fe1
Updated `HDComputeThickness` to work with CoreCLR
jrs-unity Apr 7, 2026
faea300
Updated `GlobalPostProcessingQualitySettings` to work with CoreCLR
jrs-unity Apr 7, 2026
f1a34a5
Updated `HDRenderPipeline.VolumetricLighting` to work with CoreCLR
jrs-unity Apr 7, 2026
ccefde9
Updated `HDRuntimeReflectionSystem` to work with CoreCLR
jrs-unity Apr 7, 2026
603f9c6
Updated `LocalVolumetricFogManager` to work with CoreCLR
jrs-unity Apr 7, 2026
9c914b3
Updated `MaterialDebug`, `MaterialExtension`, `MaterialPool`, and `Ma…
jrs-unity Apr 7, 2026
3ce6914
Updated `SkyManager` and `SkySettings` to work with CoreCLR
jrs-unity Apr 7, 2026
a8c59fb
Updated `STP` and `UpscalerUtils` to work with CoreCLR
jrs-unity Apr 7, 2026
4726470
Updated `SPTDistribution` to work with CoreCLR
jrs-unity Apr 7, 2026
152435f
Updated `UVOverlapDetection` to work with CoreCLR
jrs-unity Apr 7, 2026
60bf7f5
Updated `ReflectionSystemParameters` to work with CoreCLR
jrs-unity Apr 7, 2026
27e3228
Updated `ShaderVariablesRaytracing` to work with CoreCLR
jrs-unity Apr 7, 2026
ce1c352
Updated `VolumetricClouds` to work with CoreCLR
jrs-unity Apr 7, 2026
813babb
[Port] [Forward] Fix dark screen HDR output and missing variants in H…
svc-reach-platform-support Apr 7, 2026
33607e8
Make BaseShaderGUI.DrawShaderGraphProperties public
ApoorvaJ Apr 7, 2026
7254740
Fix Height Transition slider not appearing on HDRP Layered Lit materials
ApoorvaJ Apr 7, 2026
79409d5
Search table view multi edit fixes
lochrist Apr 7, 2026
f84c955
[SRP] Fix warning on tutorial SRP Blank templates
remi-chapelain Apr 8, 2026
dcbb44a
[SRP] Fix building errors with RSUV sample
remi-chapelain Apr 8, 2026
5a841a8
Fix UUM-133347: Enable shadow radius for pyramid lights in light baking
pigselated Apr 8, 2026
8b6a5c0
[VFX] Add Test Coverage for Readback
PaulDemeulenaere Apr 8, 2026
a43f593
Fix HiZ marcher on OpenGL for URP SSR
pema99 Apr 9, 2026
e0e284f
[VFX] Fix root allocations and implement memory profiler meta data fo…
ludovic-theobald Apr 9, 2026
1a0ad9e
[VFX] Disable Instable GraphicsTest on Switch
PaulDemeulenaere Apr 9, 2026
5cb5d5f
Updated `WaterDecal` and `WaterSurface` to work with CoreCLR
jrs-unity Apr 9, 2026
d80c2c6
Reset static variables for CoreCLR / Fast Enter Play Mode (SRP Core T…
arttu-peltonen Apr 9, 2026
9d69673
[CBD] Remove Mesh Build Usage
francoisunity Apr 10, 2026
b306d9c
[VFX] Workaround FXC bug with early out in SG VertMesh
ludovic-theobald Apr 10, 2026
06ec599
[Adaptive Performance] clamp cameraTargetDescriptor value to 1
tylerfan Apr 10, 2026
0b98c56
Fix color bleeding near edge of screen with HDRP SSGI
pema99 Apr 10, 2026
452450b
Suppress 'potentially uninitialized variable' warning in UnifiedRT Tr…
laylaarab Apr 10, 2026
f4f67bd
[URP]Project Auditor - Adding validations for the URP setup and known…
alex-vazquez-unity3d Apr 10, 2026
c212a70
[VFX] Add ScrollView and resizable previews to the SDF Bake tool window
ludovic-theobald Apr 10, 2026
bce70ac
[UUM-139229][URP 2D] Fix preview camera missing lighting and shadows
kennytann Apr 10, 2026
0571274
GFXLIGHT-1934 : Match SSR roughness / blur curve to reflection probes
olivierprat Apr 10, 2026
740feca
Fix shader compilation warning (double definition of CellPatchIndexBu…
urasmus Apr 10, 2026
0e71368
Graphics/fix/uum 135643 remove unifiedraytracing asset bundle from ur…
camiloapineda Apr 10, 2026
a26724d
[content automatically redacted] touching PlatformDependent folder
robinb-u3d Apr 10, 2026
cf9c2a0
Fix GFXLIGHT-2146: Adjust baking profile buffer sizes for Unity Compu…
pigselated Apr 11, 2026
b0ea30a
[HDRP][XR] Update ClearBuffer2D to support XR views
giulia-u3d Apr 13, 2026
dea3fee
[URP][HDRP] Add error messages when set Camera orthographic projectio…
giulia-u3d Apr 13, 2026
30e66f8
[VFX] Add a button to create a new ShaderGraph from an output context
julienamsellem Apr 13, 2026
6e0729f
Fix shader errors when post processing shaders are stripped
arttu-peltonen Apr 14, 2026
3405fc6
Re-enabled Switch VT tests
Adrian1066 Apr 14, 2026
8deab59
Fix SSAO misaligned with dynamic resolution (ScalableBufferManager)
ApoorvaJ Apr 14, 2026
d056c4f
Fix jittering artifact in Surface Cache caused by "rank flipping"
urasmus Apr 14, 2026
5409018
Updated `DecalProjector` and `DecalRendererFeature` to work with CoreCLR
jrs-unity Apr 14, 2026
ab3734a
Updated `TemporalAA` and `STP` to work with CoreCLR
jrs-unity Apr 14, 2026
74b43d8
Fixed Subpass enum shader keyword does not match actual shader keyword.
thomas-zeng Apr 15, 2026
2a2410b
[UUM-109492] Fixed UberPostProcess pass viewport scaling not accounti…
CalChiu Apr 15, 2026
3796602
Updated `CloudLayer`, `CloudLayerRenderer`, and `CloudSettings` to wo…
jrs-unity Apr 15, 2026
7476166
Change URP ShaderGlobalKeywords to readonly and use static initializa…
arttu-peltonen Apr 15, 2026
252da96
Updated `NormalReconstruction` to work with CoreCLR
jrs-unity Apr 15, 2026
44d490e
Use current Defrag Count in Surface Cache
urasmus Apr 15, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,20 @@ rtResources.Load();
```
**Note:** Since the Player doesn't give access to the Asset Database, this method only works in the Editor.

To load the [`RayTracingResources`](xref:UnityEngine.Rendering.UnifiedRayTracing.RayTracingResources) in the Player, you can also build the **unifiedraytracing** AssetBundle. For more information about how to build and load AssetBundles, refer to [AssetBundles](xref:AssetBundlesIntro).
To load the [`RayTracingResources`](xref:UnityEngine.Rendering.UnifiedRayTracing.RayTracingResources) in the Player, you can also build an AssetBundle that includes the following SRP Core files:
- Runtime/UnifiedRayTracing/Common/GeometryPool/GeometryPoolKernels.compute
- Runtime/UnifiedRayTracing/Common/Utilities/CopyBuffer.compute
- Runtime/UnifiedRayTracing/Compute/RadeonRays/kernels/copyPositions.compute
- Runtime/UnifiedRayTracing/Compute/RadeonRays/kernels/bit_histogram.compute
- Runtime/UnifiedRayTracing/Compute/RadeonRays/kernels/block_reduce_part.compute
- Runtime/UnifiedRayTracing/Compute/RadeonRays/kernels/block_scan.compute
- Runtime/UnifiedRayTracing/Compute/RadeonRays/kernels/build_hlbvh.compute
- Runtime/UnifiedRayTracing/Compute/RadeonRays/kernels/restructure_bvh.compute
- Runtime/UnifiedRayTracing/Compute/RadeonRays/kernels/scatter.compute

For more information about how to build and load AssetBundles, refer to [AssetBundles](xref:AssetBundlesIntro).

Once the AssetBundle is built, you can load it using the following:
```C#
var rtResources = new RayTracingResources();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ internal static string GetBakingMode(ProbeVolumeBakingSet bakingSet)

internal static void SetBakingMode(ProbeVolumeBakingSet bakingSet, string mode)
{
Undo.RecordObject(bakingSet, "Change Baking Mode");
bakingSet.singleSceneMode = (mode == "Single Scene");
}

Expand All @@ -318,6 +319,7 @@ internal static int GetSkyOcclusionBakingSamples(ProbeVolumeBakingSet bakingSet)

internal static void SetSkyOcclusionBakingSamples(ProbeVolumeBakingSet bakingSet, int samples)
{
Undo.RecordObject(bakingSet, "Change Occlusion Baking");
bakingSet.skyOcclusionBakingSamples = samples;
}

Expand All @@ -334,6 +336,7 @@ internal static void SetVolumeMode(GameObject go, string mode)
if (!go.TryGetComponent<Volume>(out var volume))
return;

Undo.RecordObject(volume, "Change Volume Mode");
volume.isGlobal = (mode == "Global");
}

Expand All @@ -350,6 +353,7 @@ internal static void SetVolumeProfile(GameObject go, VolumeProfile profile)
if (!go.TryGetComponent<Volume>(out var volume))
return;

Undo.RecordObject(volume, "Change Volume Profile");
volume.sharedProfile = profile;
}

Expand All @@ -368,6 +372,7 @@ internal static void SetLightShape(GameObject go, LightType value)

if (IsLightShapeApplicable(value))
{
Undo.RecordObject(light, "Change light Shape");
light.type = value;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -734,11 +734,11 @@ public static UInt64 TilingModeToLightmapExpandedBufferSize(TilingMode tilingMod
// TODO: We need to change the naming of the entries in the enum see: https://jira.unity3d.com/browse/GFXFEAT-728
switch (tilingMode)
{
case TilingMode.None: bufferSize = 1048576; break; // UI: Highest Performance
case TilingMode.Quarter: bufferSize = 524288; break; // UI: High Performance
case TilingMode.Sixteenth: bufferSize = 262144; break; // UI: Automatic (but it is not automatic)
case TilingMode.Sixtyfourth: bufferSize = 131072; break; // UI: Low Memory Usage
case TilingMode.TwoHundredFiftySixth: bufferSize = 65536; break; // UI: Lowest Memory Usage
case TilingMode.None: bufferSize = 2097152; break; // UI: Highest Performance
case TilingMode.Quarter: bufferSize = 1048576; break; // UI: High Performance
case TilingMode.Sixteenth: bufferSize = 524288; break; // UI: Automatic
case TilingMode.Sixtyfourth: bufferSize = 262144; break; // UI: Low Memory Usage
case TilingMode.TwoHundredFiftySixth: bufferSize = 131072; break; // UI: Lowest Memory Usage
default: Debug.Assert(false, "Unknown tiling mode."); break;
}
return math.max(bufferSize, kMinBufferSize);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,9 @@ static Vector2 GetPyramidLightRect(float coneAngleInRads, float pyramidAspectRad

static float GetLightShadowRadius(UnityEngine.LightType lightType, in LightData lightData)
{
return (Util.IsPunctualLightType(lightType) && lightType != UnityEngine.LightType.Pyramid && lightType != UnityEngine.LightType.Box) ? lightData.shape0 : 0.0f;
if (lightType == UnityEngine.LightType.Pyramid)
return lightData.shape1; // For pyramid lights, shadow radius is in shape1 (shape0 is aspect ratio)
return (Util.IsPunctualLightType(lightType) && lightType != UnityEngine.LightType.Box) ? lightData.shape0 : 0.0f;
}

internal static void InjectEnvironmentLight(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ public class FreeCamera : MonoBehaviour
public float m_Turbo = 10.0f;

#if !USE_INPUT_SYSTEM
private static string kMouseX = "Mouse X";
private static string kMouseY = "Mouse Y";
private static string kRightStickX = "Controller Right Stick X";
private static string kRightStickY = "Controller Right Stick Y";
private static string kVertical = "Vertical";
private static string kHorizontal = "Horizontal";

private static string kYAxis = "YAxis";
private static string kSpeedAxis = "Speed Axis";
private static readonly string kMouseX = "Mouse X";
private static readonly string kMouseY = "Mouse Y";
private static readonly string kRightStickX = "Controller Right Stick X";
private static readonly string kRightStickY = "Controller Right Stick Y";
private static readonly string kVertical = "Vertical";
private static readonly string kHorizontal = "Horizontal";

private static readonly string kYAxis = "YAxis";
private static readonly string kSpeedAxis = "Speed Axis";
#endif

#if USE_INPUT_SYSTEM
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Runtime.CompilerServices;
using Unity.Scripting.LifecycleManagement;
using UnityEngine.VFX;

namespace UnityEngine.Rendering
Expand All @@ -9,8 +10,13 @@ namespace UnityEngine.Rendering
/// </summary>
public struct CommandBufferHelpers
{
// These variables are just wrappers for the CommandBuffer supplied to methods below, so their state doesn't need
// to be reset when entering play mode.
[NoAutoStaticsCleanup]
internal static RasterCommandBuffer rasterCmd = new RasterCommandBuffer(null, null, false);
[NoAutoStaticsCleanup]
internal static ComputeCommandBuffer computeCmd = new ComputeCommandBuffer(null, null, false);
[NoAutoStaticsCleanup]
internal static UnsafeCommandBuffer unsafeCmd = new UnsafeCommandBuffer(null, null, false);

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ public static class CommandBufferPool
{
static ObjectPool<CommandBuffer> s_BufferPool = new ObjectPool<CommandBuffer>(null, x => x.Clear());

#if UNITY_EDITOR
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterAssembliesLoaded)]
static void ResetStaticsOnLoad()
{
s_BufferPool = new ObjectPool<CommandBuffer>(null, x => x.Clear());
}
#endif

/// <summary>
/// Get a new Command Buffer.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
using System;
using System.Collections.Generic;

namespace UnityEngine.Rendering
{
#if UNITY_EDITOR
static class ComponentSingletonRegistry
{
static readonly List<Component> s_Instances = new();

internal static void Register(Component instance) => s_Instances.Add(instance);

[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterAssembliesLoaded)]
static void ResetStaticsOnLoad()
{
foreach (var instance in s_Instances)
if (instance != null)
CoreUtils.Destroy(instance.gameObject);
s_Instances.Clear();
}
}
#endif

// Use this class to get a static instance of a component
// Mainly used to have a default instance

Expand All @@ -11,6 +32,7 @@ public static class ComponentSingleton<TType>
where TType : Component
{
static TType s_Instance = null;

/// <summary>
/// Instance of the required component type.
/// </summary>
Expand All @@ -28,6 +50,9 @@ public static TType instance

go.SetActive(false);
s_Instance = go.AddComponent<TType>();
#if UNITY_EDITOR
ComponentSingletonRegistry.Register(s_Instance);
#endif
}

return s_Instance;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,15 @@ namespace UnityEngine.Rendering
/// </summary>
public class ConstantBuffer
{
static List<ConstantBufferBase> m_RegisteredConstantBuffers = new List<ConstantBufferBase>();
static readonly List<ConstantBufferBase> m_RegisteredConstantBuffers = new List<ConstantBufferBase>();

#if UNITY_EDITOR
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterAssembliesLoaded)]
static void ResetStaticsOnLoad()
{
ReleaseAll();
}
#endif

/// <summary>
/// Update the GPU data of the constant buffer and bind it globally via a command buffer.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using Unity.Mathematics;
using Unity.Scripting.LifecycleManagement;

namespace UnityEngine.Rendering
{
Expand Down Expand Up @@ -152,10 +153,14 @@ public void Dispose()
m_ActiveItemIndices.Clear();
}

// Static s_TypeCount and TypeId<T>.value fields don't need to be reset when entering playmode.
// s_TypeCount is only incremented by the static initialization of TypeId<T>.value.
[NoAutoStaticsCleanup]
static uint s_TypeCount;

static class TypeId<T>
{
[NoAutoStaticsCleanup]
public static uint value = s_TypeCount++;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -627,5 +627,26 @@ public float GetLowResMultiplier(float targetLowRes, float minimumThreshold)

return Mathf.Clamp(thresholdPercentage / m_CurrentFraction, 0.0f, 1.0f);
}

#if UNITY_EDITOR
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterAssembliesLoaded)]
static void ResetStaticsOnLoad()
{
s_ActiveScalerSlot = DynamicResScalerSlot.User;
s_ScalerContainers = new ScalerContainer[(int)DynamicResScalerSlot.Count]
{
new ScalerContainer() { type = DynamicResScalePolicyType.ReturnsMinMaxLerpFactor, method = DefaultDynamicResMethod },
new ScalerContainer() { type = DynamicResScalePolicyType.ReturnsMinMaxLerpFactor, method = DefaultDynamicResMethod }
};
s_CameraUpscaleFilters = new Dictionary<EntityId, DynamicResUpscaleFilter>();
s_CameraInstances = new Dictionary<EntityId, DynamicResolutionHandler>(CameraDictionaryMaxcCapacity);
s_DefaultInstance = new DynamicResolutionHandler();
s_ActiveCameraId = EntityId.None;
s_ActiveInstance = s_DefaultInstance;
s_ActiveInstanceDirty = true;
s_GlobalHwFraction = 1.0f;
s_GlobalHwUpresActive = false;
}
#endif
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ internal static DebugUI.Widget CreateVolumeParameterWidget(string name, bool isR
return new DebugUI.Value() { displayName = name, getter = () => Strings.parameterNotCalculated, };
}

static DebugUI.Value s_EmptyDebugUIValue = new DebugUI.Value { getter = () => string.Empty };
static readonly DebugUI.Value s_EmptyDebugUIValue = new DebugUI.Value { getter = () => string.Empty };

struct VolumeParameterChain
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ public partial class DebugShapes
// Singleton
static DebugShapes s_Instance = null;

#if UNITY_EDITOR
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterAssembliesLoaded)]
static void ResetStaticsOnLoad()
{
s_Instance = null;
}
#endif

/// <summary>Singleton instance</summary>
static public DebugShapes instance
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,7 @@ public int[] enumValues


// Space-delimit PascalCase (https://stackoverflow.com/questions/155303/net-how-can-you-split-a-caps-delimited-string-into-an-array)
static Regex s_NicifyRegEx = new("([a-z](?=[A-Z])|[A-Z](?=[A-Z][a-z]))", RegexOptions.Compiled);
static readonly Regex s_NicifyRegEx = new("([a-z](?=[A-Z])|[A-Z](?=[A-Z][a-z]))", RegexOptions.Compiled);

/// <summary>
/// Automatically fills the enum names with a given <see cref="Type"/>
Expand Down Expand Up @@ -1040,6 +1040,41 @@ public CameraSelector()
private Camera[] m_CamerasArray;
private List<Camera> m_Cameras = new List<Camera>();

#if ENABLE_RENDERING_DEBUGGER_UI
/// <inheritdoc/>
protected override VisualElement Create()
{
var objectPopUpField = base.Create() as UIElements.PopupField<UnityEngine.Object>;

if (objectPopUpField == null)
return new Label("Error creating CameraSelector field");

objectPopUpField.choices ??= new List<UnityEngine.Object>() { null };

// Refresh the dropdown choices to keep it in sync with available cameras in the scene.
// NOTE: If the currently selected camera is deleted, PopupField handles it internally,
// so we only need to maintain the available choices list.
this.ScheduleTracked(objectPopUpField, () => objectPopUpField.schedule.Execute(() =>
{
// Using ListPool and SequenceEqual to avoid unnecessary allocations and UI updates
using (UnityEngine.Pool.ListPool<UnityEngine.Object>.Get(out var tmp))
{
tmp.Add(null);
tmp.AddRange(getObjects());

if (!tmp.SequenceEqual(objectPopUpField.choices))
{
objectPopUpField.choices.Clear();
objectPopUpField.choices.AddRange(tmp);
}
}

}).Every(500));

return objectPopUpField;
}
#endif

IEnumerable<Camera> cameras
{
get
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,22 +308,19 @@ internal VisualElement ToVisualElement(Context context)
m_Context = context;
m_VisualElement = Create();

//Debug.Log($"ToVisualElement for {queryPath}");

if (m_VisualElement == null)
{
Debug.LogWarning($"Unable to create a Visual Element for type {GetType()}");
return null;
}
m_VisualElement.AddToClassList("unity-inspector-element");

m_VisualElement.name = displayName;

#if UNITY_EDITOR
// Support for legacy state handling
if (this is ISupportsLegacyStateHandling legacyStateWidget)
{
m_RequiresLegacyStateHandling = legacyStateWidget.RequiresLegacyStateHandling();
//Debug.Log($"LegacyState: {m_RequiresLegacyStateHandling} ({queryPath})");
}
#endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ static void DisableRuntime()
#if !USE_INPUT_SYSTEM
static DebugUpdater s_Instance = null;

#if UNITY_EDITOR
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterAssembliesLoaded)]
static void ResetStaticsOnLoad()
{
s_Instance = null;
}
#endif

void Update()
{
DebugManager debugManager = DebugManager.instance;
Expand Down
Loading
Loading