I have a code that is supposed to act as sort of a crouching script. Here’s the code…
var LeftTexture :GameObject;
var RightTexture :GameObject;
var disable : GameObject;
var sprinting : GameObject;
function Update () {
if (Input.GetButtonDown ("Crouch"))
if( LeftTexture.activeSelf){
RightTexture.SetActive (true);
LeftTexture.SetActive (false);
}
else if (RightTexture.activeSelf){
LeftTexture.SetActive (true);
RightTexture.SetActive (false);
if (sprinting.activeSelf && disable.activeSelf || Input.GetButton("Jump") && disable.activeSelf)
{
LeftTexture.SetActive (false);
RightTexture.SetActive (true);
}
}
}
But, I’m not sure why, but that last part of the script doesn’t do anything…
if (sprinting.activeSelf && disable.activeSelf || Input.GetButton("Jump") && disable.activeSelf)
{
LeftTexture.SetActive (false);
RightTexture.SetActive (true);
}
How do I fix this?