playMaker

Author Topic: Set audio clip variable [SOLVED]  (Read 7804 times)

speedything

  • Playmaker Newbie
  • *
  • Posts: 13
Set audio clip variable [SOLVED]
« on: January 23, 2012, 02:07:53 PM »
Hi guys,

I'm trying to use the "Set Audio Clip" action with a variable audio object but I can't find the variable. Reproduction steps are...

1. Create an FSM and add an object variable - "audioClip"
2. Select the "Set Audio Clip" action and assign a Game Object with an audio source component. I would expect to be able to assign the variable created in step 1 to the "Audio Clip" field, but it can't see it.

The same thing problem occurs with the "Audio Play" action.

Am I doing something wrong? Or is this a bug with the action?

Thanks,

« Last Edit: January 24, 2012, 04:31:37 PM by alexchouls »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Set audio clip variable
« Reply #1 on: January 24, 2012, 01:57:09 AM »
Hi,

 It looks like you are missing something yes, I just reproduced your steps and all is well.

1: create a object variable and set it to be of type "Audio clip"
2: drag the audio clip from the project folder onto the variable "Object value"
3: in the "set audio clip" and "play audio", you can select the variable you have set up.

I think you are assigning the wrong element to the Object value, you need to drag the actual audio clip from the project folder. else, can you clarify?

 Bye,

 Jean

speedything

  • Playmaker Newbie
  • *
  • Posts: 13
Re: Set audio clip variable
« Reply #2 on: January 24, 2012, 03:51:46 AM »
Doh - wasn't setting the type properly.

Thanks Jean

Carlostastic

  • Playmaker Newbie
  • *
  • Posts: 2
Re: Set audio clip variable [SOLVED]
« Reply #3 on: March 07, 2013, 08:30:15 AM »
Hi

I found this thread and it was exactly what I was looking for except, I can't find variable Type, Audio Clip in my list of variable types? Am not sure if I've missed something here? Or I'm missing something from Unity. Please help!

Carlostastic

  • Playmaker Newbie
  • *
  • Posts: 2
Re: Set audio clip variable [SOLVED]
« Reply #4 on: March 07, 2013, 08:51:35 AM »
Hi

I managed top solve it, I wasn't looking properly for the Unity Engine type! It all works now, thanks for the above thread and images they really helped!

Many thanks!  :D

memetic arts

  • Full Member
  • ***
  • Posts: 141
Re: Set audio clip variable [SOLVED]
« Reply #5 on: May 03, 2013, 03:45:11 PM »
This makes sense, but I'm having a bit of a brain-glitch in figuring out how you would change the Object Value dynamically, e.g. pick from a list of clips and assign it to the Object Value. 

Assume that I'm not using ArrayMaker (no time to learn right now), and I've statically created the list via a public array to which I've dragged the audio clips in the inspector.

Is this possible to do purely in PM, or will I need to use scripts to assign values to PM variables?

Thanks!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Set audio clip variable [SOLVED]
« Reply #6 on: May 07, 2013, 03:30:46 AM »
Hi,

 I am not sure I understand what you mean by "statically". Have you created a script?

bye,

 Jean

memetic arts

  • Full Member
  • ***
  • Posts: 141
Re: Set audio clip variable [SOLVED]
« Reply #7 on: May 08, 2013, 10:07:34 AM »
Hi -

By "statically" I meant "not-dynamically", e.g. manually dragged audio clips to the inspector before runtime. 

In the end, while I as able to I altered my approach and I'm setting the clip on the Audio Source via Resources.Load().  Since that doesn't seem to be supported in PM (and no time to start learning how to create Actions -- that will be next month!), I'm using a simple one-line function.

Took a long time, though, to finally discover that I had to use the Invoke action rather than the Send Message action to call a script on another GameObject!  Live and learn, I suppose . . .

Cheers,

==rr