Fix selected province fade flicker (#8700)

This commit is contained in:
2026-07-18 08:28:05 -07:00
committed by GitHub
parent 009a4ffe53
commit 3dce099b2a
2 changed files with 21 additions and 0 deletions
@@ -1,3 +1,4 @@
using System;
using System.Linq;
using eagle;
using NUnit.Framework;
@@ -50,6 +51,23 @@ namespace eagle0.Tests {
"ProvinceWeatherController should update the project weather map material.");
}
[Test]
public void MapAnimationRunsAfterModelUpdates() {
Assert.Greater(
ExecutionOrderFor(typeof(MapController)),
ExecutionOrderFor(typeof(EagleGameController)),
"MapController must animate province colors after EagleGameController can " +
"replace the model and reset their base colors.");
}
private static int ExecutionOrderFor(Type componentType) {
var attribute =
componentType.GetCustomAttributes(typeof(DefaultExecutionOrder), inherit: false)
.Cast<DefaultExecutionOrder>()
.SingleOrDefault();
return attribute?.order ?? 0;
}
private static Material LoadMaterial(string path, string expectedShaderName) {
var material = AssetDatabase.LoadAssetAtPath<Material>(path);
Assert.NotNull(material, $"{path} must exist.");
@@ -10,6 +10,9 @@ using ProvinceId = System.Int32;
using FactionId = System.Int32;
namespace eagle {
// Model and highlight state are updated by other controllers in Update. Run afterward so an
// incoming model cannot overwrite the animated province colors before they are rendered.
[DefaultExecutionOrder(100)]
public class MapController : MonoBehaviour {
public EagleGameController eagleGameController;