Using FMOD with Grid Controller

Announcements, support questions, and discussion forum for Grid Controller.
Post Reply
Imagino1234
Posts: 2
Joined: Tue Feb 14, 2023 10:49 pm

Using FMOD with Grid Controller

Post by Imagino1234 »

I want to use FMOD for my project for all the sound effects, and while I'm glad to see that Grid Controller allows for integration of external audio systems, the instructions in the manual are not clear about how to get Grid Controller and FMOD set up. At most, the instructions say that "[t]o use any other input system, such as FMOD or Wwise, implement IGridControllerAudio."

The problem is, I don't know where to implement IGridControllerAudio. Which FMOD file do I need to implement it the interface?
User avatar
Tony Li
Posts: 20632
Joined: Thu Jul 18, 2013 1:27 pm

Re: Using FMOD with Grid Controller

Post by Tony Li »

Hi,

Make a new script named something like FMODGridControllerAudio that implements the C# interface IGridControllerAudio. Here's a simple example:

Code: Select all

using UnityEngine;
using PixelCrushers.GridController;

public class FMODGridControllerAudio : MonoBehaviour, IGridControllerAudio
{
    public void PlayBounce(Surface surface)
    {
        FMODUnity.RuntimeManager.PlayOneShot("event:/Bounce");
    }

    public void PlayDoor(AudioInfo audioInfo, Vector3 position)
    {
        FMODUnity.RuntimeManager.PlayOneShot("event:/Door");
    }

    public void PlayFootstep(Surface surface, float volume)
    {
        FMODUnity.RuntimeManager.PlayOneShot("event:/Footstep");
    }
}
Then inspect your GridController GameObject/prefab, remove the GridControllerAudio component, and add your FMODGridControllerAudio. Also add an FMODStudioListener to the Camera.
Imagino1234
Posts: 2
Joined: Tue Feb 14, 2023 10:49 pm

Re: Using FMOD with Grid Controller

Post by Imagino1234 »

Thank you very much for your help! I'll follow up if I have any further trouble, but so far I haven't run into any trouble.
User avatar
Tony Li
Posts: 20632
Joined: Thu Jul 18, 2013 1:27 pm

Re: Using FMOD with Grid Controller

Post by Tony Li »

Glad to help!
Curiacity
Posts: 3
Joined: Fri Mar 22, 2024 2:35 pm

Re: Using FMOD with Grid Controller

Post by Curiacity »

Hello!
I know this is an old post but I'm hoping to get some help. I was using this for a project and up until this morning, it's been working as intended in Unity. Today for some reason the script won't work though. I haven't changed anything about it in the slightest, but it's just greyed out in the inspector. It does show "No MonoBehaviour scripts in the file, or their names do not match the file name."
This project is going back and forth through github if that matters.
User avatar
Tony Li
Posts: 20632
Joined: Thu Jul 18, 2013 1:27 pm

Re: Using FMOD with Grid Controller

Post by Tony Li »

Hi,

Which script?

Are there any errors or warnings in the Console window? If there are other compilation errors, even unrelated to Grid Controller, it can cause Unity to not be able to recognize scripts on GameObjects.
Curiacity
Posts: 3
Joined: Fri Mar 22, 2024 2:35 pm

Re: Using FMOD with Grid Controller

Post by Curiacity »

Hello!
We got it working after a bit of tuning up the system, but now we're trying to implement different surface types. The way we have surface detection is using ray casting against colliders. Is there a way to set up the script from original posts to detect those surfaces at all?
User avatar
Tony Li
Posts: 20632
Joined: Thu Jul 18, 2013 1:27 pm

Re: Using FMOD with Grid Controller

Post by Tony Li »

Hi,

Grid Controller already detects Surfaces. This post should be helpful: How To: Extend Surface Data
Curiacity
Posts: 3
Joined: Fri Mar 22, 2024 2:35 pm

Re: Using FMOD with Grid Controller

Post by Curiacity »

I'm still newer to the coding side of it, but specifically with fmod events for the footsteps of our project and getting those to corollate with the specific surface types is what I'm struggling with. The link is helpful!
User avatar
Tony Li
Posts: 20632
Joined: Thu Jul 18, 2013 1:27 pm

Re: Using FMOD with Grid Controller

Post by Tony Li »

Getting FMOD to play footstep sounds doesn't require any scripting. Page 20 of the manual explains how to play a single footstep event for all surfaces. To play different footstep sounds for different surfaces, please wait for version 1.0.10. I've added an FMODSurfaceType that you can assign to your Surfaces to play FMOD events when walking on the surface or bumping into it.
Post Reply