Greetings all, i’m a Unity newb but a long time fan… I jumped in with specific project in mind and it’s going well. I needed a way to fade objects to a transparent states and I found iTween to fit the bill nicely… I’m having a mysterious issue though…
the Goal
I fiddled with iTween for many hours and finally got something working (which proves my Plugins folder is correct and everything is in a healthy path I suppose). I am making a “soundboard” using some high res animations I made http://LitStudios.com/unity/mpx_interactive.mov . I got the interactivity working alright. The user presses a a portion of the screen (or touch table in my case) and one of these anims comes up with audio. it loops until the user presses that anim again to turn it off.
the Problemo
i am trying to use iTween to both fade the alpha to 0 (transparent) and fade the audio to 0, then stop the movie texture and audio so it can be restarted again in a healthy way (a 1 or 2 second linear tween is my goal). I learned that the stop/start on the loop in unity is not great, i never really restart the sample from dead silence, it always plays back a bit of what was playing when i stopped it previously, hence my desire to fade to nothingness. ok, so I never got the Alpha tween working, though I got “MoveTo” doing something (as a test, though it didn’t move the whole object, just the audio gizmo, i know i’m missing something simple), and I now have volume ramping down to silence (though it never really “stops” because i cannot start the audio again, it remains silent or cannot be refired.
the Setup
I have a flat plate with a movie texture on it, along with the audio contained in the .mov file, and I created a js for each plane containing the following:
renderer.material.mainTexture.loop = true;
renderer.material.mainTexture.Stop();
audio.Stop();
function Update () {
if (Input.GetButtonDown ("Fire2")) {
if (renderer.material.mainTexture.isPlaying) {
renderer.material.mainTexture.Stop();
audio.Stop();
//iTween.AudioTo(gameObject,{"volume":0,"time":1,"onComplete":"audioStopped"}); //this tweens
//iTween.FadeTo(gameObject,{"alpha":0}); //this does not tween
}
else {
renderer.material.mainTexture.Play();
audio.Play();
}
}
}
It seems straight forward to me. the code above has the iTween stuff commented, so this code just starts the anim/audio, stops it, and restarts it, forever, that works fine.
as mentioned, when i did a MoveTo using iTween, it ONLY moved the little speaker icon, I assume that’s a good hint.
Any help would be greatly appreciated. Thanks. using Unity Pro trial, fwiw a screenshot at http://litstudios.com/unity/unityscreen.jpg