Audio and DOTS

Hi, maybe I’m an idiot, which is very probable, but I cant find any resource at all on how to incorporate audio into my dots project. Is there anywhere I can learn how to have my entities trigger audio? Thanks

1 Like

DOTS audio API is undocumented and more like in preview state.
I do expect it to change dramatically, after DOTS 1.0+ is released. Which may be 2023, 2024 or later.
I don’t know if DOTS audio API works at al with Entities 0.50 / 0.51.

You need to look into source code, if you want to work with DOTS audio API.
Other than that, you may want to use Unity native audio API.

OK thanks, I don’t think I’m going to be able to do that then. The only way I know how to deal with collisions is from the unity collision demo and they only deal with entities in that demo. I might be getting a little ahead of myself

It might be too early for you to explore this, but I will link it here anyways: Latios-Framework/Documentation~/Myri Audio/README.md at v0.5.6 · Dreaming381/Latios-Framework · GitHub

1 Like

I tried, but I was getting an error with that package, I think it needs to be updated or something

Dang it! Why is the Script Updater not running for people all of a sudden? :rage: You are the second person today to tell me about that, whereas people had been reporting it working in 0.51 for weeks, and it has also worked for me.

It’s not your fault. I’ll eventually track this down. Or I just force everyone to move to Entities 0.51.1 in a patch this weekend, which sucks.

1 Like

The easiest solution is to use a normal GameObjects for the audio. This is not the best performant solution. There is some code in this thread which should work for audio. Add particle in DOTS
(Also note the fix needed to get it to work in editor mentioned in this thread.)

If you just want audio to work, I think this is a good start.

1 Like

I use atm Unity audio for our RTS project.
With spatial mapping and some audio tricks, it works sufficently so far.

My point is, most game even dots, can use Unity audio just fine. People won’t recognise if there is 51 units shooting or 87. It is about smart implementing mechanics.

Basically smoke and mirrors.
Plus still having 3d spatial audio.

3 Likes

I mean… They had dots audio with individual audio sources at Megacity demo at 2019. How does it not a thing anymore?

They updated the packages and made a breaking change to what was done in Megacity. The packages work still, and are what Myri is built on. But other than fixing Burst-compatibility, the packages haven’t seen any updates for a while now.

So can we use it for the production it’s current form? I like the ability of having individual audio sources w/o major performance hits.

You can try it. Procedural audio in DSPGraph works. I don’t know about SampleProviders since I don’t use that feature in Myri.

For some people (myself included), Unity crashes when calling AudioClip.ReadData() while converting a subscene for a build. Otherwise, the only other issue I am aware of with Myri is that Unity doesn’t always run the Script Updater on it between Entities 0.50 and Entities 0.51.

1 Like

In industry most studios use FMOD and being a native library it should be callable from burst as is.

3 Likes

I just gave it a try with “FMOD for Unity

RuntimeManager.PlayOneShot(guid);

but RuntimeManager is managed

public class RuntimeManager : MonoBehaviour

Or are there other solutions to get Fmod to work with Burst?

You would not use the actual unity library and instead just the underlying native one. The unity library is just wrapping this.

1 Like

Ah got it, that’s what you meant. But then things are getting complicated again I guess. Would be nice to have burst-compatible wrapper out there.