Grounding Player at Start

Sorry if this isn’t the right thread for this question - I’m very new to Unity and the forums here, so please feel free to redirect me if this would be better posted somewhere else.

Working in version 2021.3.20f1.

At the start of the game, no matter what Y point I set my FPS character to, it always starts off with the player “landing” into the level as if they had jumped - which with my landing SFX starts the game off with a thump and a grunt, which is not exactly how I want it to begin. I found a similar thread suggesting to lowering the skin width of the controller, which I tried, but that didn’t make any difference. Also have tried playing around with “isGrounded” and “isPreviouslyGrounded” setting each to true/false in the Awake function, but no difference there either.

It’s a relatively minor annoyance, and one I could probably learn to live with, but I know from games I’ve played that there must be a way around it, and probably an easy one at that if I weren’t such a noob, lol.

Random ideas, since you haven’t shared any code:

  • Make sure you are not playing the fall SFX’s with PlayOnAwake toggled to true in your AudioSource.
  • Try using the debugger, if you’re not used to it already, I recommend forcefully practicing it, or looking for tutorials on how to use it.

If you’re using VS (Visual Studio), you can set a breakpoint and slowly find out what is going on at the start of your game, and what is triggering those sounds. Place breakpoints on whatever method triggers the sound, you can even open the stack trace window, this is a window in VS that can tell you previous methods where called until reaching the line where you put your breakpoint.

Confirmed that PlayOnAwake is toggled off - tried your breaking points suggestion, but that didn’t yield any results, other than that if I break point the LandingSound code it won’t play at all (obviously, lol).

Another note: I’m currently using FMOD as my audio controller, but I was having this same issue before I switched to FMOD and was using the built-in Unity audio player.

The full code for my FPS controller is a bit extensive, but here’s the Awake, Update, HandleJump, and PlayLandSound functions, which I’m guessing are the parts I need to focus on (annotations are //commented):

void Awake()
    {
        instance = this;

        playerCamera = GetComponentInChildren<Camera>();
        characterController = GetComponent<CharacterController>();
        defaultYPos = playerCamera.transform.localPosition.y;
        defaultFOV = playerCamera.fieldOfView;
        currentHealth = 100;
        currentStamina = 100;
        Cursor.lockState = CursorLockMode.Locked;
        Cursor.visible = false;
        m_PreviouslyGrounded = false;
//I've toggled m_PreviouslyGrounded to both false and true, but no result either way.
   }
     
void Update()
    {
        if (CanMove)
        {
            HandleMovementInput();
            HandleMouseLook();

            if(canJump)
                HandleJump();

            if (canCrouch)
                HandleCrouch();

            if (canUseHeadbob)
                HandleHeadbob();

            if (canZoom)
                HandleZoom();

            if (useFootsteps)
                Handle_Footsteps();

            if (canInteract)
            {
                HandleInteractionCheck();
                HandleInteractionInput();
            }

            if (useStamina)
                HandleStamina();

            ApplyFinalMovements();
           }
         }
      
private void HandleJump()
    {
        if (ShouldJump)
        {
            moveDirection.y = jumpForce;
            PlayJumpSound();
         }

        if (!m_PreviouslyGrounded && characterController.isGrounded)
        {
            PlayLandingSound();
        }
        m_PreviouslyGrounded = characterController.isGrounded;
    }
 //I've toggled  putting the last line "m_PreviouslyGrounded = characterController.isGrounded;" in and out of the If Statement Brackets, but that also had no effect.

private void PlayLandingSound()
    {
        if (Physics.Raycast(playerCamera.transform.position, Vector3.down, out RaycastHit hit, 3))
        {
            switch (hit.collider.tag)
            {
                    case "Footsteps/Wood":
                    FMODUnity.RuntimeManager.PlayOneShot("event:/Player/Footsteps/Land/WoodLand");
                    break;
                    case "Footsteps/Metal":
                    FMODUnity.RuntimeManager.PlayOneShot("event:/Player/Footsteps/Land/MetalLand");
                    break;
                    case "Footsteps/Carpet":
                    FMODUnity.RuntimeManager.PlayOneShot("event:/Player/Footsteps/Land/CarpetLand");
                    break;
                    case "Footsteps/Tile":
                    FMODUnity.RuntimeManager.PlayOneShot("event:/Player/Footsteps/Land/TileLand");
                   break;
                    case "Footsteps/Concrete":
                    FMODUnity.RuntimeManager.PlayOneShot("event:/Player/Footsteps/Land/ConcreteLand");
                    break;
                case "Footsteps/VentDuct":
                    FMODUnity.RuntimeManager.PlayOneShot("event:/Player/Footsteps/Land/VentDuctLand");
                    break;
               default:
                    FMODUnity.RuntimeManager.PlayOneShot("event:/Player/Footsteps/Land/ConcreteLand");
                    break;
            }
            NextStep = StepCycle + .5f;
        }
    }
    }

The same thing happens when I use the Standard Assets FPS controller, which is why I thought it might be a common Unity setting thing (like the PlayOnAwake toggle) that I was missing.