This is a baseball game.
I have a script called IsGrounded with a boolean.It gets triggered to false which makes another script called fielding become false.This is showing both to be enabled = false,which is what i want.Now fielding i thought would be inactive without the script being checked as true,but it is still active even though it is checked to false.
I have read many other things about this in unity answers which says the scripts are still active unless i enable or disable in update,Late update or maybe Start function.how can i change my code for this i dont have update in my fielding script.here my codes
IsGrounded code
var IsGrounded = false;
function Update()
{
IsGrounded = false;
}
function OnCollisionEnter(other:Collision)
{
if(other.collider.name == ("Terrain"))
IsGrounded = true;
if(IsGrounded == true)
{
gameObject.Find("P_SS").GetComponent("Fielding").enabled = false;
Debug.Log("Grounded");
}
}
fielding code
function OnCollisionEnter(other:Collision)
{
if(other.collider.name == ("BaseBall(Clone)"))//&& IsGrounded == false)
{
Destroy(other.gameObject);
audio.Play();
}
}