Dharengo / Spriter2UnityDX

Converts Spriter .scml files to Unity prefabs
155 stars 41 forks source link

Added Support for Spriter Sounds #2

Closed mjholtzem closed 7 years ago

mjholtzem commented 9 years ago

Must have Audio Listener in Scene (duh)

Should handle most audio formats but have only really tested with .wav

Dharengo commented 9 years ago

It's a good start, but there are a few issues I have with it. Some are just personal things, but I'll leave those be, here are the important ones:

-The Try/Catch block is unnecessary. A simple null check works better, and you don't have to set up an exception handler. -SoundPlayer and AudioSource components are added even when they are not necessary.

Think you can do something about that? I'll see if I can figure out the rest.

mjholtzem commented 9 years ago

I can definitely fix the SoundPlayer and AudioSource components being added. As for the try/catch block in the animation builder, I initially tried to just check if animation.soundlines was null but for some reason it would not work and I'd always get runtime errors. It could be that I'm just doing something dumb though.

Dharengo commented 9 years ago

Hm... Well make whatever changes you can. Maybe I'll be in a coding mood this weekend and I'll take a look at it myself.

mjholtzem commented 9 years ago

Ok I just went back in and gave it another go and this time around it worked no problem... Not sure what to make of that. Most likely was just making a silly mistake earlier but it seems to work ok :D

mjholtzem commented 9 years ago

Dharengo, does this require any additional modification before it's put into your branch?

Dharengo commented 9 years ago

I did not realise that you went ahead and changed the code. I'll merge it.

mjholtzem commented 9 years ago

Good call, didn't run into this because I only used animation events for sounds.

I'll try a couple of things and see what works best. Going off of your TextureController might be the best so that the code base has some consistency. I'm also thinking it may be possible to store references to the sound events in a scriptable object or something so that instead of clearing all of the events the sound ones can be removed.

Anyway thanks for looking carefully at it