PlayMaker Updates & Downloads > Share New Actions

Set Mixer Float Value(s)

(1/5) > >>

tropical:
Hi all,

as I could not find an easy way to access exposed audio mixer parameters with playmaker, I have written an action to set the value of an exposed parameter using the SetFloat function of the unity audio mixer. Then I tried to rewrite it so one can set the values of more than one parameter.

The background: Unfortunately unity's audio mixer snapshot system does not work properly with time scale set to 0 (maybe it will in the future). So you cannot use it in a game pause.
- EDIT (11-10-2017): Ability to transition AudioMixer snapshots by scaled and unscaled time added in Unity 5.3.6 (see Release Notes Unity 5.3.6 and ScriptingAPI-AudioMixer.updateMode) -

Both actions work. Nevertheless... these are my first actions and I have no experience in writing code. So it would be great if someone (maybe Jean) could tell me if there are any "bad", unusual, or unnecessary elements in my actions - especially the second one: I am not sure about the compound array thing and about introducing private variables.

EDIT (09-26-2015): Now both actions are available on the Ecosystem.

See the code on github:

AudioMixerSetFloatValue

AudioMixerSetMultiFloatValues

in the category AudioMixer.

A few things worth mentioning: To use these actions you have to manually expose parameters in the mixer first. Their names in the action editor field have to be written correctly (you can create a string variable if you want). When you set the values of exposed mixer parameters using SetFloat / using these actions, those parameters cannot be controlled by the snapshot system unless you use the ClearFloat function. Watch the unity tutorial (audio mixer exposed parameters).

EDIT (11-10-2017): Another AudioMixer action on the Ecosystem:
AudioMixerGetFloatValue (see code on GitHub: AudioMixerGetFloatValue).

Thank you.
Bye

jeanfabre:
Hi,

 This is great!

 Can I put these on the Ecosystem? It will be easier for people to get it. You can do it yourself as well, I can guide you, it's easy. Let me know what you prefer.


Bye,

 Jean

tropical:
Hi Jean,

yes, you can put the actions on the Ecosystem. Better you do it. If I touch the cs-files again, the temptation of opening them and changing a word in a tooltip line (or something like that) is too great for me.  :)

Thank you very much.

jeanfabre:
Hi,

 Ok, I have put them on the Ecosystem, Thanks :)

I renamed them for consistency, starting with the context: AudioMixerSetxxx

The code itself is fine, nothing wrong, I just put a check so that if the audioMixer is null it doesn't fire error if it's not defined.

 Bye,

 Jean

tropical:
Thanks, Jean!

I could edit my first post (replace the code/attachments with the changed version from the ecosystem), if you think that's necessary. Or should I leave it as it is?

Navigation

[0] Message Index

[#] Next page

Go to full version