I’m trying to pass a value from a player script to the camera script, to see if the player had ducked to move the camera. I’ve tested the bool in the player script and it returned the correct value but when I pass the bool to the camera script it constantly returns false.
void PlayerDuck()
{
if(headpos.y < duckThreshold)
{
duck = true;
//Debug.LogError("ducking ");
}
else
{
duck = false;
//Debug.LogError("not ducking ");
}
but in the cam script it keeps returning false in the update method after i init the variable in the start method.
_ducking = GameObject.Find("player").GetComponent<Duck>().duck;
and the update method constantly shows it as false
void Update () {
Debug.LogError(_ducking);
}