Search Issue Tracker

By Design

Votes

0

Found in

2019.1.0a11

2019.1.0b9

2019.2.0a1

Issue ID

1141766

Regression

No

Signal emitters disregard the "Emit Once" field when they affect parent Timelines or are placed at end of Timelines

Timeline

-

How to reproduce:
1. Open the attached project "case_1141766-SignalsNoRepeatIssue" and scene "SampleScene"
2. Select "ControlObject" to view its Timeline
3. Double click its control track to view the "RewindParent" child Timeline track
4. Enter Play Mode
5. Observe the Timeline's play head and the Game View

Expected result: the "RewindParent" Timeline emits the "repeat" signal thus rewinding the child cube's animation back a second only once
Actual result: the "RewindParent" Timeline emits the "repeat" signal indefinitely even though the signal emitter's "Emit Once" field is set

Reproducible with: 2019.1.0b9, 2019.2.0a10
Could not test with: 2019.1.a10 (repro project's timeline assets cannot be opened)

Note: in the Console Window notice that the "rewind" signal is also triggered on the "RewindSelf" object's Timeline but it does not perform the action of rewinding when it is placed at the very end of the Timeline. Also, notice that if the signal is moved to the middle (moving the signal moves it for both the "RewindParent" and "RewindSelf" as they use the same Timeline Prefab) of the Timeline the "RewindParent" GameObject's Timeline emits the "rewind" signal only once even though the "Emit Once" field is turned off

  1. Resolution Note (2019.2.X):

    The Emit Once property works as expected: when a timeline begins playing, the Emit Once state is reset.

    Here's what's happening:
    1) Playback on the parent and the child begins
    2) Playback on the child hits the end of the timeline. At this point, two things happen (in this order):
    - Since the child timeline is finished, it is paused (OnBehaviourPause is called).
    - The "rewind" signal is sent, which sets the time on the parent
    3) The parent continues playing from the time set by the "rewind" signal. The parent sees that its child timeline is paused and changes its state to Playing. Since there is a change in the play state of the child timeline, the Emit Once state is reset, and the signal is emitted indefinitely.

    There are two ways to avoid this:
    a) Move the signals to the parent timeline. The parent timeline will not change its playstate and thus the Emit Once state will not be reset.
    b) Move the last signal a couple of frames before the end of the child timeline or add a couple of frames to the child timeline's duration. If the signal is sent before the child timeline ends, the Emit once state will not be reset.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.