Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression in AnyState Transition: setNumberState + fireState Misbehaves in 9.13.8 (Works in 9.12.2) #357

Open
miyashita-code opened this issue Feb 23, 2025 · 0 comments

Comments

@miyashita-code
Copy link

Title

Regression in AnyState Transition: setNumberState + fireState Misbehaves in 9.13.8 (Works in 9.12.2)

Description

We are using the official Rive Android Runtime API to update a state machine’s inputs by calling setNumberState immediately followed by fireState to trigger transitions from AnyState. In Rive.app’s preview, this approach reliably produces the expected state transitions (e.g. switching between different facial expressions). However, in Android Runtime 9.13.8 the following issue occurs:

  • When calling fireState immediately after setNumberState, the state machine transitions from AnyState to a specific state (e.g. "particle1" or "changeEye-idle") only once, and subsequent state updates fail to occur.
  • In contrast, downgrading to version 9.12.2 results in the expected behavior, with each trigger causing the correct state transition and corresponding animation.

Provide a Repro

Please use the minimal reproduction steps below:

  1. In your Rive file, create a state machine that uses a numeric input (e.g. facialExpressionSelector) and a trigger input (e.g. facialExpressionTrigger) to set up transitions from AnyState to specific states.
  2. In your Android app, implement a function similar to the one below to change the facial expression:
fun setFacialExpression(
    riveView: RiveAnimationView,
    machineName: String,
    expression: FacialExpression
) {
    // Update the numeric input
    riveView.setNumberState(machineName, "facialExpressionSelector", expression.intValue.toFloat())
    // Immediately fire the trigger
    riveView.fireState(machineName, "facialExpressionTrigger")
}
  1. Invoke this function from each facial expression button’s onClick handler.

Source .riv/.rev file

RIV
credit : CC-BY, Remix from Ryuhei's work
Origin

Expected behavior

The expected behavior is that, as in Rive.app’s preview, calling fireState immediately after setNumberState reliably triggers the correct transition from AnyState to the intended state (corresponding to each facial expression) and plays the appropriate animation.

Screenshots

Image

Image

Device & Versions (please complete the following information)

  • Device: Jerry Star
  • SDK Level: Android 13, API 33
  • Rive Android Runtime:
    • 9.13.8 – Issue present
    • 9.12.2 – Works as expected

Additional context

According to the official Rive documentation and GitHub source code, the methods setNumberState and fireState are designed to support transitions from AnyState properly.
Starting with version 9.13.7, improvements were made to trigger evaluation (processing triggers reliably per layer). However, in version 9.13.8, using this approach causes the state machine to transition to an incorrect state (e.g. "particle1" or "changeEye-idle") only once, and no further state updates occur. This regression is not observed in version 9.12.2, where the expected state transitions and animations are triggered reliably with each call.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant