備忘録です。
衝突なしで、干渉してるかをチェックする。
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ChangeClolrRed : MonoBehaviour{
    void OnTriggerStay(){//接しているとき
        GetComponent<Renderer>().material.color = Color.red;
    }
    void OnTriggerExit(){//離れたとき
        GetComponent<Renderer>().material.color = Color.blue;
    }
}オブジェクトのColliderのトリガーをチェック
Rigidbodyを追加
 
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
  
  
  
  
コメント