(サンプルスクリプト)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Metal : MonoBehaviour
{
void Update()
{
if(Input.GetKeyDown(KeyCode.Z))
{
GetComponent<MeshRenderer>().material.color = Color.red;
GetComponent<MeshRenderer>().material.SetFloat("_Metallic", 0.8f);
}
}
}
(実行結果)