Skip to content

A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.

UI: drop the obsolete MeshWriteData.uvRegion (CS0618) (#452)

Eyal Golanac1146d8ccca
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a178cb433..fa5a40de6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -304,6 +304,9 @@ adds a line under **Unreleased**; CI's `Changelog` job checks this (see `CONTRIB
It decodes to the same bytes, so the terrain is unchanged (#44).
### Fixed
+- The Unity build has no compiler warnings again. The panel trim's corner ornament no longer uses
+ `MeshWriteData.uvRegion`, which Unity 6000.3 marks obsolete (CS0618); the renderer now maps texture coordinates itself.
+ The pixels are unchanged.
- "Operation Yoav" now dates the attack on the supply convoy to 15 October 1948, not 14 October, as Israel's own reply in
the Acting Mediator's report S/1042 and the IDF account of the operation both give it. The rest of the card is
unchanged (refs #442).
diff --git a/unity/Assets/Scripts/UI/UiFrame.cs b/unity/Assets/Scripts/UI/UiFrame.cs
index 3c6991a26..c5396c84e 100644
--- a/unity/Assets/Scripts/UI/UiFrame.cs
+++ b/unity/Assets/Scripts/UI/UiFrame.cs
@@ -134,8 +134,9 @@ namespace Statecraft.Game.UI
/// <summary>One quad from the corner (cx, cy) inwards (sx, sy), size x size, tinted.</summary>
public static void Quad(MeshGenerationContext mgc, Texture2D texture, float cx, float cy, float sx, float sy, float size, Color tint)
{
+ // UVs in the texture's own 0..1 space: UI Toolkit remaps them into the atlas itself (MeshWriteData.uvRegion is
+ // obsolete in Unity 6.3 for that reason).
var m = mgc.Allocate(4, 6, texture);
- var uv = m.uvRegion;
(float u, float v)[] corners = { (0, 0), (1, 0), (1, 1), (0, 1) };
foreach (var (u, v) in corners)
m.SetNextVertex(new Vertex
@@ -143,7 +144,7 @@ namespace Statecraft.Game.UI
position = new Vector3(cx + sx * u * size, cy + sy * v * size, Vertex.nearZ),
tint = tint,
// texture row 0 is the bottom, design y grows downwards
- uv = new Vector2(uv.xMin + u * uv.width, uv.yMin + (1f - v) * uv.height),
+ uv = new Vector2(u, 1f - v),
});
// UI Toolkit wants clockwise triangles on screen; a quad mirrored on one axis reverses the order
if (sx * sy > 0) { m.SetNextIndex(0); m.SetNextIndex(1); m.SetNextIndex(2); m.SetNextIndex(0); m.SetNextIndex(2); m.SetNextIndex(3); }