I've been following the FMOD Youtube pages tutorial for Survival shooter but nothing is working (details in description)


The first part where I attach the event to the hellaphant animation event won’t play anything however I accidentally added the event to the hellaphants movement animation and it played but only in the middle of the map as if the listener were only where the game started.
The second part about called the emitter to play on the health script doesn’t work and instead gives won’t let enemies take damage at all giving me an error.

NullReferenceException: Object reference not set to an instance of an object CompleteProject.EnemyHealth.TakeDamage (Int32 amount, Vector3 hitPoint) (at Assets/_Complete- Game/Scripts/Enemy/EnemyHealth.cs:57) CompleteProject.PlayerShooting.Shoot () (at Assets/_Complete- Game/Scripts/Player/PlayerShooting.cs:108) CompleteProject.PlayerShooting.Update () (at Assets/_Complete-Game/Scripts/Player/PlayerShooting.cs:47)

This is driving me mad. Please help.

1 Like

The position of the sound is determined by the position of the GameObject that the script is attached to:

FMODUnity.RuntimeManage.PlayOneShot(path, GetComponent<Transform>().position);

Or the sound doesn’t have a 3D panner on it, making it 2D and audible everywhere.

The NullReferenceException doesn’t mention anything about FMOD.
It is saying one these objects are null/not assigned:

CompleteProject.EnemyHealth.TakeDamage()

If you can use break points to stop the code on this line, you should be able to hover over each name and it will tell you if it is valid or not.

Exactly the same for me. The event in the death animation doesn’t play, the same event in the move animation does play. Any idea why?
I converted the Unity project to a recent version (2020) and I’m using FMOD 2.02 studio and integration plugin ; that doesn’t seem to be a problem, the project seems totally valid.

When you profile the project using live update, does an event instance get started by the death animation but produce no audible output, or does the event not get triggered at all?

Not triggered at all. Here’s a video showing the problem. Am I doing something wrong?
EDIT: sorry, the video didn’t captured that, but I’m doing a copy/paste of the event, from the move animation to the death animation. So it can’t be a syntax problem.

After some experimentation, I’ve discovered that a PlaySound event attached to the Hellephant’s death animation won’t play if it’s too close to the start of the animation. If you place the event at around 0:20 or later in the death animation, the FMOD Studio event will play.

I suspect the earlier frames of the death animation are being skipped somehow, as they do not appear to play when an Hellephant is slain in-game, but I have not yet found the part of the Unity project that causes this frame skip to occur.