my environment:
Win7 x64
Unity Pro 3.5.5
c#(Visual studio 2010)
my objective:
i am making a mobilegame with unity3d.
and i making a bombeffect.
the effect plays its own sound when it is showing.
spec:
the effect is maked a single prefab with a plan, sprite texture.
and has a Audiosource (drag&dropped a wav file to Prefab in Inspector)
the bombeffect is managed by my custom object pool so i disabled play on awake option in Inspector. (because it recycled by my custom rule)
so i coded that :
//when the booming is begin
GameObject obj;
obj = MyObjectPool.Recycle("Prefabs/BombEffect"); //try recycle
if(obj != null)
{
//every object's first creation is doing here
obj = Instantiate("Prefabs/BombEffect") as GameObject;
MyObjectPool.StartManage(obj);
}
obj.audio.play(); //play
problem:
the bombeffect is rapidly created. (the attack speed is very fast)
but the sound playing is works like a SINGLETON. it means if the bombeffect audio is start playing, than other bombeffect gameobject's audio can't played. until the first PLAYING bombeffect is stop naturally.
but according to my knowledge, a prefab's Audio Source is can multiple-played sametime with another prefab's Audio Source. but it is not. i don't understand. how can i play multiple-play same audio wav file ?