Page 1 of 1
Using FMOD with Grid Controller
Posted: Tue Feb 14, 2023 10:56 pm
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?
Re: Using FMOD with Grid Controller
Posted: Wed Feb 15, 2023 8:46 am
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.
Re: Using FMOD with Grid Controller
Posted: Wed Feb 15, 2023 10:05 pm
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.
Re: Using FMOD with Grid Controller
Posted: Wed Feb 15, 2023 10:28 pm
by Tony Li
Glad to help!
Re: Using FMOD with Grid Controller
Posted: Mon Mar 25, 2024 5:02 pm
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.
Re: Using FMOD with Grid Controller
Posted: Mon Mar 25, 2024 8:35 pm
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.
Re: Using FMOD with Grid Controller
Posted: Sat Mar 30, 2024 11:37 am
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?
Re: Using FMOD with Grid Controller
Posted: Sat Mar 30, 2024 5:01 pm
by Tony Li
Hi,
Grid Controller already detects Surfaces. This post should be helpful:
How To: Extend Surface Data
Re: Using FMOD with Grid Controller
Posted: Sat Mar 30, 2024 6:10 pm
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!
Re: Using FMOD with Grid Controller
Posted: Sat Mar 30, 2024 9:55 pm
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.