SHA256
Fix OnLastUpdate Callback Skipped Without NonTile
This commit is contained in:
1 file changed
+34
-4
+34
-4
@@ -396,19 +396,49 @@ internal class RenderManager : MonoBehaviour
|
|||||||
frameCount++;
|
frameCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Floors that own a hold renderer, collected from scrLevelMaker.listFloors (see RefreshHoldFloors).
|
||||||
|
private readonly List<scrFloor> _holdFloors = new();
|
||||||
|
private List<scrFloor>? _holdFloorsSource;
|
||||||
|
private int _holdFloorsSourceCount = -1;
|
||||||
|
|
||||||
public void OnLastUpdate()
|
public void OnLastUpdate()
|
||||||
{
|
{
|
||||||
if (Instance.stage < RenderStage.Load) return;
|
if (Instance.stage < RenderStage.Load) return;
|
||||||
if (!Configuration.AdvancedConfig.NonTile) return;
|
|
||||||
foreach (var floor in scrLevelMaker.instance.listFloors
|
if (Configuration.AdvancedConfig.NonTile)
|
||||||
.Where(floor => floor.holdRenderer && floor.holdRenderer.m_meshRenderer.enabled))
|
|
||||||
{
|
{
|
||||||
floor.holdRenderer.m_meshRenderer.enabled = false;
|
// scrHoldRenderer.UpdateColor sets m_meshRenderer.enabled = true every time it runs
|
||||||
|
// (scrHoldRenderer.cs, called from scrPlanet/scrPlayer), so the hold meshes are disabled again every frame.
|
||||||
|
RefreshHoldFloors();
|
||||||
|
foreach (var floor in _holdFloors)
|
||||||
|
{
|
||||||
|
if (!floor || !floor.holdRenderer) continue;
|
||||||
|
var meshRenderer = floor.holdRenderer.m_meshRenderer;
|
||||||
|
if (meshRenderer && meshRenderer.enabled) meshRenderer.enabled = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TriggerOnLastUpdate();
|
TriggerOnLastUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Rebuilds the hold floor list when scrLevelMaker.listFloors is a different list or has a different count
|
||||||
|
/// (hold renderers are created together with the floors in scrLevelMaker).
|
||||||
|
/// </summary>
|
||||||
|
private void RefreshHoldFloors()
|
||||||
|
{
|
||||||
|
var floors = scrLevelMaker.instance.listFloors;
|
||||||
|
if (ReferenceEquals(floors, _holdFloorsSource) && floors.Count == _holdFloorsSourceCount) return;
|
||||||
|
|
||||||
|
_holdFloors.Clear();
|
||||||
|
foreach (var floor in floors)
|
||||||
|
{
|
||||||
|
if (floor && floor.holdRenderer) _holdFloors.Add(floor);
|
||||||
|
}
|
||||||
|
_holdFloorsSource = floors;
|
||||||
|
_holdFloorsSourceCount = floors.Count;
|
||||||
|
}
|
||||||
|
|
||||||
// ReSharper disable once Unity.IncorrectMethodSignature
|
// ReSharper disable once Unity.IncorrectMethodSignature
|
||||||
public void OnPostFrame(RenderTexture? texture)
|
public void OnPostFrame(RenderTexture? texture)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user