What do I want to do?
The script below is attached to a gameobject called MainCamera
I want to check if there is a collision between 3 objects :
a gameobject that contains a script called “WhiteChecker”
a gameobject called path1 or path2.
This script is working when I attach it to path1 path2. but this script is NOT working obviously, when I attach it to MainCamera.
How can I edit my script so what I asked above will work?
void OnCollisionEnter(Collision Other)
{
if ( Other.gameObject.GetComponent( typeof(WhiteChecker) ) != null)
{
renderer.enabled = false;
}
}
void OnCollisionExit(){
renderer.enabled = true;
}