Playmaker Forum
PlayMaker Updates & Downloads => Share New Actions => Topic started by: jeanfabre on September 03, 2012, 10:34:29 AM
-
Hi,
Just a simple action to play a audio item when using Audio Toolkit
http://u3d.as/content/clock-stone-software-gmb-h/audio-toolkit/2AG (http://u3d.as/content/clock-stone-software-gmb-h/audio-toolkit/2AG)
I don't own a version, so it's blind coding, please let me know if that doesn't work out :)
// (c) Copyright HutongGames, LLC 2010-2012. All rights reserved.
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory("Audio toolkit")]
[Tooltip("Play an Audio item")]
public class AudioToolkitPlay : FsmStateAction
{
[RequiredField]
public FsmString reference;
public override void Reset()
{
reference = null;
}
public override void OnEnter()
{
AudioController.Play(reference.Value);
}
}
}
bye,
Jean
-
Thank you that works. Of course the moment you do this you are going to need to stop it again! Hacked your script:
// (c) Copyright HutongGames, LLC 2010-2012. All rights reserved.
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory("Audio toolkit")]
[Tooltip("Stop Playing an Audio item")]
public class AudioToolkitStop : FsmStateAction
{
[RequiredField]
public FsmString reference;
public override void Reset()
{
reference = null;
}
public override void OnEnter()
{
AudioController.Stop(reference.Value);
}
}
}
At some point we will need to be able to address a different Audio Controller, being a component on another object. So we'll need to add a way to select the object on which the component is attached. Cheers.
-
Hi,
excellent, this is the spirit yes, simply hack other actions, If you have trouble making other actions let me know,
bye,
Jean
-
Hi, thanks for this it work well just the sound is not parented to the game object, so when game object move with 3d sound its not good.
i used this script:
using UnityEngine;
using System.Collections;
public class PlaySfxOnce : MonoBehaviour {
public string sfxID;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void onCall () {
AudioController.Play( sfxID, transform );
}
}
can we change it to an action like this where we can define the gameobject to parent the sound with a action public field for gameobject target? i tried to do like in my script but it return an error
-
praying for Jeanfabre to pay some more few attention to this toolkit ;D
Here is the free version
http://u3d.as/content/clock-stone-software-gmb-h/audio-toolkit-free-version/2Bi
-
hi still any way to get some help for these actions?
-
Hi,
I hear you, tho I have 300+ posts to go catch up as I was away for some time. So please keep bumping this, I will do my best to cover that toolkit. Bump this next monday or something. Never fear bumping what you want, this helps a lot. This toolkit seems very simple, so I might be able to squeeze the basic needs to begin with.
bye,
Jean
-
thank you Jeanfabre if i can help you in any way just let me know !
-
:) can you make my day with few more hours ;D
I have to turn down projects, it's that bad at this moment, so I must honor paid work at the moment, things are getting easier in january generally, so keep bumping this thread please, this is the best way ( and actually a message to everyone reading this that would like some attention to other threads I might have missed or forgot about... keep bumping, this is the best way to see where to focus)
bye,
Jean
-
actually what would be nice
-setup the volume of a category
-start/stop/pause a category or playlist
-read and parent a sound to a gameobject ( like explained above )
-
still no news for the actions? :-[
-
merry Christmas to Jean Fabre, please dont forget my christmas audio toolkit actions! ;D
-
:D :D
-
This is very interesting, I'll be keeping an eye on this :) friendly bump, and thanks for all that you are doing!
-
This is very interesting, I'll be keeping an eye on this :) friendly bump, and thanks for all that you are doing!
/assist :D
-
Yeah I ran into this one as well. Audio Toolkit will create a new object at the point where the call is made with the sound attached. If the calling object keeps moving on, then the sound gets left behind.
So really what would have happen is to instantiate the sound object and then immediately make it a child of the calling object. Something like 'Set Parent' would do it, but you would have to attach that to the new object on the fly.
-
still no news for the action to attach a played sound to a gameobject?
-
Hi,
Ok, please find a updated play action that will accept all the different play functions. again it's blind coded, I don't own AudioToolkit yet, so tell me if that works as expected.
UPDATE: now with finished event, you can optionnaly set an event that will be fired with the audio reference finished playing.
// (c) Copyright HutongGames, LLC 2010-2013. All rights reserved.
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory("Audio toolkit")]
[Tooltip("Play an Audio item. Optionnaly send an event when autio item finished playing")]
public class AudioToolkitPlay : FsmStateAction
{
[RequiredField]
public FsmString reference;
public FsmVector3 worldPosition;
public FsmOwnerDefault parent;
public FsmFloat volume;
public FsmFloat delay;
public FsmFloat startTime;
public FsmEvent AudioCompletlyPlayedEvent;
public override void Reset()
{
reference = null;
worldPosition = null;
parent = null;
volume = 1f;
delay = 0f;
startTime = 0f;
AudioCompletlyPlayedEvent = null;
}
public override void OnEnter()
{
var go = Fsm.GetOwnerDefaultTarget(parent);
AudioObject _obj;
if (go == null)
{
_obj = AudioController.Play(reference.Value,worldPosition.Value,volume.Value,delay.Value,startTime.Value);
}else{
_obj = AudioController.Play(reference.Value,worldPosition.Value,go.transform,volume.Value,delay.Value,startTime.Value);
}
if (AudioCompletlyPlayedEvent!=null)
{
_obj.completelyPlayedDelegate = OnAudioCompleteleyPlayed;
}
}
void OnAudioCompleteleyPlayed( AudioObject audioObj )
{
Debug.Log( "Finished playing " + audioObj.audioID + " with clip " + audioObj.audio.clip.name );
Fsm.Event(AudioCompletlyPlayedEvent);
Finish();
}
}
}
bye,
Jean
-
thank you Jean Fabre this is awesome, dont know if i can ask a little more. :D
i need an action to send and event when playing a sound file is finish, maybe can use this:
http://unity.clockstone.com/audiotoolkitreference/html/P_AudioObject_completelyPlayedDelegate.htm
just a public string for the sound ID and select what event return
-
Hi,
Can you bump this thread next week? I'll have a look then, if not earlier on.
bye,
Jean
-
dont worry, bumped it will be :D
-
I'll bump this. A send event after a sound file is finished would be quite useful to me
-
Hi,
ok, updated the action to feature now an optional event to be fired when audio finishes.
bye,
Jean
-
Hi jean, can you make an action for pitch?
Thanks
-
Hi,
I have some issues understanding how to work it out, I have an action made up but I need to study how to set it up properly.
Let me contact the author to know how to do this properly.
bye,
Jean
-
From clockstone
You have access to all properties. Use AudioController.GetAudioItem("myAudioID") to get the AudioItem, then all subitems are in AudioItem.subItems. See the reference documentation for more info (http://unity.clockstone.com/audiotoo...nce/Index.html
This is from unity forums
I dont understand too.
Thankmyou
-
Hi,
We are in contact already, don't worry, I have everything I need, I'll be posting soon on this.
bye,
Jean