holopy3/Assets/Scripts/ChangeMaterial.cs

30 lines
544 B
C#
Raw Permalink Normal View History

2021-01-28 12:07:52 +00:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ChangeMaterial : MonoBehaviour
{
public Material Platinum;
private MeshRenderer mr;
private void OnEnable()
{
PassTheEdgeTrigger.OnPassingTheEdge += ChangeMat;
}
private void OnDisable()
{
PassTheEdgeTrigger.OnPassingTheEdge -= ChangeMat;
}
private void Start()
{
mr = GetComponent<MeshRenderer>();
}
private void ChangeMat()
{
mr.material = Platinum;
}
}