i've discovered that light probe system update is taking a significant amount of time. i'm not using lightprobe at all in the game so i'm not sure why it's doing all that compute, and i couldnt figure out a way to shut it down. is it possible to do it? did i catch a red herring in that it's NOT actually light probe but something else taking so long?
#light probe system taking 14ms per frame!
1 messages · Page 1 of 1 (latest)
after disabling lightprobe on several renderers, i can see this value quickly tick down, which is great, but i definitely don't want to go about disabling lightprobe for every single of my renderer.
after some research
var world = World.DefaultGameObjectInjectionWorld;
var systemTypes = world.Systems;
foreach (var system in systemTypes)
{
if (system.GetType().Name == "LightProbeUpdateSystem")
{
system.Enabled = false;
// Debug.Log("LightProbeUpdateSystem disabled");
run = true;
break;
}
}
this can disable the system, however renderers taht don't have blend probe set to null will render incorrectly. doesnt seem to be a way around it 😢
ok i have arrived at this janky solution
using Unity.Burst;
using Unity.Collections;
using Unity.Entities;
using Unity.Rendering;
using UnityEngine;
[BurstCompile]
public partial struct DisableLightProbeSystem : ISystem
{
public void OnCreate(ref SystemState state)
{
state.RequireForUpdate<BlendProbeTag>();
}
public void OnUpdate(ref SystemState state)
{
var ecb = new EntityCommandBuffer(Allocator.Temp);
foreach (var (blendprobe, entity) in SystemAPI.Query<RefRO<BlendProbeTag>>().WithEntityAccess()) {
ecb.RemoveComponent<BlendProbeTag>(entity);
}
ecb.Playback(state.EntityManager);
ecb.Dispose();
}
}