// Update is called once per frame void FixedUpdate() { healthMeter.SetHealth(currentHealth); //meter code float moveHorizontal = Input.GetAxis("Horizontal"); float moveVertical = Input.GetAxis("Vertical"); Vector2 movement = new Vector2(moveHorizontal, moveVertical); rb2D.AddForce(movement * speed); }
void FixedUpdate() { healthMeter.SetHealth(currentHealth); //links your variable to the meter's fill }