- Home /
Can 2 iTween components run on the same gameobject simultaneously?
I have 2 audio sources on the same object. One which I would tween volume from 0 to 1 represented by:
iTween.AudioTo(channelTarget.gameObject, iTween.Hash("name", "fadein", "audiosource", newChannel.audioSource, "volume", busVolume, "time", 8F)
And the other audio source which would tween volume from 1 to 0 represented by:
iTween.AudioTo(channelTarget.gameObject, iTween.Hash("name", "fadeout", "audiosource", Channel.audioSource, "volume", 0F, "time", 8F));
Both iTween components attach to the game object but the first one gets inturrupted and disposed by the second.
Has anyone encountered something like this?
Answer by justinl · Oct 13, 2012 at 02:08 PM
I've had the same problem as you Brenden. My solution was to create 2 individual GameObjects that are parented to your parent object. Then each of those game objects has it's own AudioSource. Works perfectly for cross fading.
Unfortunately this is a small element of a much larger audio engine I'm writing. I can't afford the luxury of having multiple game objects because the user defines which game object these sounds are attached to in the event.
I was forced to manually tween the crossfade over an update function ins$$anonymous$$d.
Thank you for your response!
Ah! You're welcome. At least you've figured out your own way as well that fits your project. Cheers
Answer by Kirbyrawr · Oct 07, 2012 at 10:32 PM
I recommend you to use Visual Itween Editor from assets store , it's free and it allow to do the thing you want. Cheers ^^
Your answer
![](https://koobas.hobune.stream/wayback/20220613082002im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to avoid audio glitches whilst switching volume of an Audiosource each Update()-Frame? 0 Answers
AudioSource.ignoreListenerVolume warning 1 Answer
How to get current volume of an AudioSource. 3 Answers
What is the exact equation being used for sound volume? 0 Answers
Breathing volume increases as player gets more tired 0 Answers