fix(scripting): stabilize mono wrapper test teardown

This commit is contained in:
2026-04-15 14:27:21 +08:00
parent 982a877714
commit 65cb212020
8 changed files with 351 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
using XCEngine;
namespace Gameplay
{
public sealed class MeshRendererPathProbe : MonoBehaviour
{
public bool MeshRendererLookupSucceeded;
public int ObservedInitialMaterialCount;
public string ObservedInitialMaterial0Path = string.Empty;
public int ObservedUpdatedMaterialCount;
public string ObservedUpdatedMaterial1Path = string.Empty;
public void Start()
{
MeshRendererLookupSucceeded = TryGetComponent(out MeshRenderer meshRenderer);
if (meshRenderer == null)
{
MeshRendererLookupSucceeded = false;
return;
}
ObservedInitialMaterialCount = meshRenderer.materialCount;
ObservedInitialMaterial0Path = meshRenderer.GetMaterialPath(0);
meshRenderer.SetMaterialPath(1, "Materials/runtime_override.mat");
ObservedUpdatedMaterialCount = meshRenderer.materialCount;
ObservedUpdatedMaterial1Path = meshRenderer.GetMaterialPath(1);
}
}
}