What am I doing wrong? I am calculating the distance of the object and I am using that float to set that value to the parameter, however it doesn´t work, The distance is being calculated but it doesn´t change the parameter
[SerializeField] AK.Wwise.RTPC myDistanceParameter;
[SerializeField] float distance;
[SerializeField] GameObject player;
[SerializeField] GameObject audioParameter;
void FixedUpdate()
{
if (player == null)
{
PlayerCheck();
}
else PlayerDistance();
}
void PlayerCheck()
{
player = GameObject.FindGameObjectWithTag("Player");
}
void PlayerDistance()
{
distance = Vector3.Distance(gameObject.transform.position, player.transform.position);
myDistanceParameter.SetValue(audioParameter, distance);
}