event.SetTimeLinePosition() doesn't work?

Hello,

Same issue here, trying to set the time during an event is being played.


	internal void SetTime(float normalizedTime)
	{
		EventInstance e = lastEventInstanceClassic;
		if (e.getDescription(out EventDescription desc) == FMOD.RESULT.OK)
		{
			if (desc.getLength(out int len) == FMOD.RESULT.OK)
			{
				// module 1 gives the decimal part if the time > 1 (ex: 2.425 % 1 == 0.425)
				int wantedPos = (int)(len * (normalizedTime % 1));

				wantedPos = 2000;

				if (e.setTimelinePosition(wantedPos) == FMOD.RESULT.OK)
				{
					if (Verbose || VerboseAllPlays)
						Debug.Log(Log("SFX played at time: " + wantedPos + " / " + len), this);
				}
				else
				{
					Debug.LogWarning(LogWarning("Can't set Time"), this);
				}
			}
			else
			{
				Debug.LogWarning(LogWarning("Can't get Length"), this);
			}
		}
		else
		{
			Debug.LogWarning(LogWarning("Can't get Description"), this);
		}
	}

I tried setting the position to a fixed value but it doesn’t do anything.
The event is a timeline within FMOD Studio (not an Action sheet)

After a little digging => The issue seems to come from the “async” flag being ticked
I want the first sound synchronised to the timeline and the other independant, so it should fix my issue :slight_smile:

Yes, it was that.

So things to check :

  • Your event should play a Timeline sheet, not an Actions one. (if getLength returns 0, that may be the case)
  • Your Sound must NOT be “async” on the Track, or moving the position wouldn’t affect the Sound.

You can actually check the way the timelinePosition work within FMOD Studio by clicking on the graphical timeline. (between the tabs and the “Logic Tracks”). If the behaviour doesn’t match what you expect, the issue probably lie within the FMOD Studio project instead of the Unity integration (or other game engines)

Cheers,
Sylafrs