I wanna control timeline


(Jun) #1
void PlayBatRandom()
{
	EventInstance pEiMob = SoundSystem.GetEvent("event:/Monster_bat");
	int nRandom = Random.Range(0, 4);
	nSelect = nRandom*2;
	pEiMob.setTimelinePosition(nSelect);

	int nSelect = 0;
	pEiMob.getTimelinePosition(out nSelect);
	Debug.Log(nSelect);
	pEiMob.start();
}

////////////////////////////////////////////////////////////////////////////////////////////

I play sound with this code but only start play timeline = 0

how can I play another seconds?


(Nicholas Wilcox) #2

If you look at the documentation, setTimelinePosition() takes the desired position in milliseconds.

http://52.88.2.202/documentation/#content/generated/FMOD_Studio_EventInstance_SetTimelinePosition.html

The fix would be

pEiMob.setTimelinePosition(nSelect * 1000);