Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: markfrancombe on May 03, 2016, 02:46:30 AM

Title: Random Sound Action not working on ios
Post by: markfrancombe on May 03, 2016, 02:46:30 AM
Hello!

I have been using the play random sound action to play from a pool of 4 different sounds every time an electric guitar is "thrown" across a room. And it worked well in Unity. However, when I built for IOS (its a google cardboard project) none of the sounds work. ALL other sounds in my game are fine, but that is the only place Im using that action. Is it not ios friendly for some reason?
I may be mistaken, but I think its the only sound making action that doesnt require an audio source component to be added to the object, instead replying on a "position" parameter to "Place" the sound in space. This I did by getting the transform of the guitar, and saving that variable, and sending that into the sound location slot of the action.

I tried remaking the same functionality using the more normal "Audio play" action, with a random event action providing the random choices of the sounds... maybe more actions required to achieve this, and although it worked, it was not as robust and sometimes fails to play. Although this may be some other error in my set-up, i didn't spend too long troubleshooting this method, before writing this.

Any clues here?

Can post screenshots of my setup later, if needed, but at work now, and not able to get to my project.

Mark
Title: Re: Random Sound Action not working on ios
Post by: Budde88 on May 03, 2016, 04:38:46 AM
Maybe post a screenshot,

I can confirm that in my project it is def working on an ios device.
Title: Re: Random Sound Action not working on ios
Post by: markfrancombe on May 03, 2016, 05:14:42 AM
@Budde88 Thats good to know, So I think its either that this action DOES infact require an Audio Component somewhere, OR that my transform variable that "Places" the sound at a location is way off... I have had an error before where it defaulted to 0,0,0 and not the transform of the object that should make the sound... But that doesnt explain why it works fine in Unity...

But glad to hear the randome sound actin works, as that WAS working well in Unity...

Will post shots later if I dont solve it...
Title: Re: Random Sound Action not working on ios
Post by: markfrancombe on May 03, 2016, 05:26:21 PM
OK heres my FSM
(http://i.imgur.com/q4D4zNL.png)
In the first state, I set up a few things.
A float for guitar volume
I get the transform of the guitar and save it as variable GEETAR
And wait a bit...
(http://i.imgur.com/Y70DYNs.png)
This is for a fix where the guitar makes a noise the second the game loads, as its collider  immediately hits the floor, so I set the volume to 0 for a bit... hence the wait. I don't think theres any need for the first GuitarNOISE state, its just left over from before, but it serves the purpose of accepting a collision,

So then its sent thru this state that turns up the volume...
(http://i.imgur.com/C4VGVtj.png)

and moves to this one
which actually plays the sounds. Note the variable GEETAR stuck in there so that the sound appears to come from the location of the guitar
(http://i.imgur.com/YXNydFs.png)

From then on it just cycles back and forth between 2 copies of this.. on every collision... this is so 2 sounds can overlap... now I have done it Im not sure this was needed either... as I can see "One Shot Audio"s appearing in the hierarchy...

Anyway.. I could def tidy this up a bit, but it works as is IN UNITY.. and my question still stands...

Why doesn't it work after building for IOS?
Title: Re: Random Sound Action not working on ios
Post by: markfrancombe on May 05, 2016, 05:48:17 PM
OK...

You can ignore all the images above. I have now re-built this whole thing WITHOUT using the random sound action, just to see if it was that at all..
And its not, ITS STILL works fine in Unity, but after building to IOS it doesnt work.

To reiterate.. ALL OTHER SOUNDS are working fine, NOTHING different with the programming of this, but does NOT work in IOS..
I am totally stumped now... the only thing I can think of is if the sounds themselves are somehow not working for IOS. But I have done my usual thing, that is make them OGG...

Help!!!
Title: Re: Random Sound Action not working on ios
Post by: jeanfabre on May 06, 2016, 01:38:15 AM
Hi,

 Nothing gets outputed in the xcode console when you play in debug mode on IOS?

I would isolate the sounds that don't work against the sound that works and do the following, then switch them in your logic to rule out that it's the sound file itself

Bye,

 Jean
Title: Re: Random Sound Action not working on ios
Post by: markfrancombe on May 07, 2016, 05:14:09 PM
Hi JEAN!
YOU SAID:
Nothing gets outputed in the xcode console when you play in debug mode on IOS?
Im sorry I dont know what this means... What is the xcode console OR debug mode on IOS?
Im pretty new to IOS and no one tells you this stuff.. All I have figured (for cardboard) is click xcode open, add security framework and disable bitcode... (all thru trial and error and googling)
however...
I would isolate the sounds that don't work against the sound that works and do the following, then switch them in your logic to rule out that it's the sound file itself

This I get and of course tried... KNOWN working sounds, (that are workign fine on IOS in other parts of game (same scene, same room infact) inserted into the Random sound action do NOT work once exported to IOS

This issue is driving me mad!
I have even completely REMADE the Play Random Sound action as seperate actions that I am using elsewhere and are KNOWN to work... and THAT DONT WORK EITHER!!!
This.(http://i.imgur.com/O7xuwjY.png)
But this didnt work, so I went back to the previous as it was less actions and seemed more elegant and simple...
Im going crazy! I tell ya this is the final bug before I release it!

Mark


Title: Re: Random Sound Action not working on ios
Post by: markfrancombe on May 07, 2016, 07:30:31 PM
OK interesting test results!

So I simplified my set-up. Placed the collision sound code onto a sphere in the room.
did a build, same result.. no sound on collision.

I added a change material action, so that on collision, at the same time as the sound triggering action it would change colour.. In Unity.. it did... I did another IOS build and on the phone.. it didnt!

So what does this mean?

That collisions are not working on IOS???

Mark
(http://i.imgur.com/4pAOvaH.png)
Title: Re: Random Sound Action not working on ios
Post by: jeanfabre on May 09, 2016, 04:26:38 AM
Hi,

 ok, that's odd. If you can isolate this and send the project to me, I'll test locally to verify this is reproduceable and will debug it.


Bye,

 Jean
Title: Re: Random Sound Action not working on ios
Post by: markfrancombe on May 09, 2016, 02:21:34 PM
OK trying to reduce proj down.. its not a huge proj as it is, but Ill see what I can do...

Title: Re: Random Sound Action not working on ios
Post by: jeanfabre on May 19, 2016, 03:21:29 AM
Hi,

 sorry for the delay.

 Indeed I can repro this given the project you sent me, and I am trying to tweak it so that sounds works. It's very odd I give you that.

I'll keep you updated, keep bumping if I haven't reply beginning of next week. I'd like to get to the bottom of this as it seems Unity 5 changed a lot with audio and that actions needs to be carefully refactored or used differently.

 
Bye,

 Jean