ColorChange.cs
460 Bytes
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ColorChange : MonoBehaviour
{
MeshRenderer mesh;
Material mat;
void Start()
{
mesh = GetComponent<MeshRenderer>();
mat = mesh.material;
}
private void Update()
{
}
private void OnCollisionEnter(Collision collision)
{
Debug.Log("충돌");
mat.color = new Color(1, 0, 0);
}
}