I have two cubes. If my fps passes through cubeA first, the script in cubeB will be disabled and if my fps passes through cubeB first then the script of cubeA will be disabled. How am I suppose to code this? Please help me!
//Write This on cubeB’s script say ScriptB…
OnCollisionEnter(Collision col)
{
if(col.gameObject.name == "cubeA"){
col.gameObject.GetComponent<ScriptA>().enabled = false;
}
}
// Write This on cubeA's script say ScriptA...
OnCollisionEnter(Collision col)
{
if(col.gameObject.name == "cubeB"){
col.gameObject.GetComponent<ScriptB>().enabled = false;
}
}