30 lines
1.0 KiB
C#
30 lines
1.0 KiB
C#
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);
|
|
}
|
|
}
|
|
}
|