Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: speedything 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,
-
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
-
Doh - wasn't setting the type properly.
Thanks Jean
-
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!
-
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
-
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!
-
Hi,
I am not sure I understand what you mean by "statically". Have you created a script?
bye,
Jean
-
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