# Footstep script

**URL:** <https://qa.fmod.com/t/footstep-script/14660>\
**Category:** Unity\
**Created:** [May 9, 2019, 9:53am UTC](https://qa.fmod.com/t/footstep-script/14660 "2019-05-09T09:53:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![riario](https://avatars.discourse-cdn.com/v4/letter/r/9de0a6/32.png) [@riario](https://qa.fmod.com/u/riario)\
**Post date:** [May 9, 2019, 9:53am UTC](https://qa.fmod.com/t/footstep-script/14660/1 "2019-05-09T09:53:19Z")

</div>

Hello everyone,

Im developing a small game on unity and I am going to use Fmod to implement sounds of any sort. But I’m struggling to run a footstep script I found from a tutorial on youtube (Scottgamesounds). the script looks like this:  
using System.Collections;  
using System.Collections.Generic;  
using UnityEngine;

```
public class Footsteps : MonoBehaviour {

     [FMODUnity.EventRef] 
     public string InputFootsteps;
     FMOD.Studio.EventInstance FootstepsEvent;
     FMOD.Studio.ParameterInstance WoodParameter;
     FMOD.Studio.ParameterInstance MetalParameter;
     FMOD.Studio.ParameterInstance GrassParameter;

     bool playerismoving;
     public float walking speed
     private float WoodValue;
     private float MetalValue;
     private float GrassValue;
     private bool playerisgrounded;

     void Start ()
     {
         FootstepsEvent = FMODUnity.RuntimeManager.CreateInstance(InputFootsteps);
         FootstepsEvent.getParameter ("Wood", out WoodParameter);
         FootstepsEvent.getParameter ("Metal", out MetalParameter);
         FootstepsEvent.getParameter ("Grass", out GrassParameter);

         InvokeRepeating ("CallFootsteps", 0, walkingspeed);
     }

     void Update () 
     {
         WoodParameter.setValue (WoodValue);
         MetalParameter.setValue (MetalValue);
         GrassParameter.setValue (GrassValue);

         if (Input.GetAxis ("Vertical") >= 0.01f || Input.GetAxis ("Horizontal") >= 0.01f || Input.GetAxis ("Vertical") <= -0.01f || Input.GetAxis ("Horizontal") <= -0.01f)
         {
             if (playerisgrounded == true) 
             {
                 playerismoving = true;
             } 
             else if (playerisgrounded == false) 
             {
                 playerismoving = false;
             }
         } 
         else if (Input.GetAxis ("Vertical") == 0 || Input.GetAxis ("Horizontal") == 0) 
         {
             playerismoving = false;
         }
     }

     void CallFootsteps ()
     {
         if (playerismoving == true) 
         {
             FootstepsEvent.start();
         } 
         else if (playerismoving == false) 
         {
             //Debug.Log ("player is moving = false");
         }
     }

     void OnDisable ()
     {
         playerismoving = false;
     }

     void OnTriggerStay(Collider MaterialCheck)
     {
         //float FadeSpeed = 10f;
         playerisgrounded = true;

         if (MaterialCheck.CompareTag ("Wood:Material")) 
         {
             WoodValue = 1f;
             MetalValue = 0f;
             GrassValue = 0f;
         }
         if (MaterialCheck.CompareTag ("Metal:Material")) 
         {
             WoodValue = 0f;
             MetalValue = 1f;
             GrassValue = 0f;
         }
         if (MaterialCheck.CompareTag ("Grass:Material")) 
         {
             WoodValue = 0f;
             MetalValue = 0f;
             GrassValue = 1f;
         }
     }

     void OnTriggerExit (Collider MaterialCheck)
     {
         playerisgrounded = false;
     }

```

The Main (Hopefully the only) problem is the usage of “FMOD.Studio.ParameterInstance” and “.getParameter” that unity doesn’t recognise. I think that libraries of Fmod have changed in the past so I cannot use these instances anymore.

Does anybody how to replace them correctly or have you any good advice to run this script properly?

Thanks.

---

<div class="post-metadata">

**Author:** ![riario](https://avatars.discourse-cdn.com/v4/letter/r/9de0a6/32.png) [@riario](https://qa.fmod.com/u/riario)\
**Post date:** [May 9, 2019, 10:08am UTC](https://qa.fmod.com/t/footstep-script/14660/2 "2019-05-09T10:08:59Z")

</div>

![12](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/1X/0b7ee3f492c509a130ed6957a740c44ed2be2f6a.png)

This is exactly what Visual Studio says

---

<div class="post-metadata">

**Author:** ![cameron-fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cameron-fmod/32/261_2.png) [@cameron-fmod](https://qa.fmod.com/u/cameron-fmod)\
**Post date:** [May 14, 2019, 12:18am UTC](https://qa.fmod.com/t/footstep-script/14660/3 "2019-05-14T00:18:12Z")

</div>

This script will likely work in FMOD 1.10 but not without changes for 2.00 as the Parameter API has completely changed.

[https://fmod.com/resources/documentation-api?version=2.0&page=welcome-whats-new-200.html#new-parameter-api](https://fmod.com/resources/documentation-api?version=2.0&page=welcome-whats-new-200.html#new-parameter-api)
