Hi,everyone!
The problem is:
When I added on my settings menu a option to adjust the volume of the game and I played the first level,I could move my player without any problem,but when I activated the pause menu and clicked the menu option so that I could go to the main menu to change the volume again and I went back,my player couldn’t move,I pressed “w” and it wasn’t moving.I’ll put the player movement script here:
using UnityEngine;
public class PlayerMoviment : MonoBehaviour
{ //É uma referência para "Rigidbody" o "rb"
public Rigidbody rb;
public float forwardForce = 2000f;
// Update is called once per frame
//FixedUpdate é usado para brincar com o código
void FixedUpdate()
{ //Adiciona uma força para frente
rb.AddForce(0 ,0, forwardForce * Time.deltaTime);
if (Input.GetKey("d"))
{
//É apenas executado se a condição é apresentada
rb.AddForce(40 * Time.deltaTime, 0, 0, ForceMode.VelocityChange);
}
if (Input.GetKey("a"))
{
rb.AddForce(-40 * Time.deltaTime, 0, 0, ForceMode.VelocityChange);
}
if (Input.GetKey("w"))
{
rb.AddForce(0, 34 * Time.deltaTime, 0, ForceMode.VelocityChange);
}
if (Input.GetKey("s"))
{
rb.AddForce(0, 0, -34 * Time.deltaTime, ForceMode.VelocityChange);
}
if (rb.position.y < -1f)
{
FindObjectOfType<GameManager>().EndGame();
}
}
}