fix(scripting): stabilize mono wrapper test teardown
This commit is contained in:
29
managed/GameScripts/MeshRendererPathProbe.cs
Normal file
29
managed/GameScripts/MeshRendererPathProbe.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user