rive-app / rive-android

A runtime for interactive animations on Android
https://rive.app
MIT License
332 stars 30 forks source link

How to Handle error "No StateMachineInput found with name" #318

Open harisAsterbyte opened 3 months ago

harisAsterbyte commented 3 months ago

I attempted to change the state using the following code: riveFile?.fireState("GirlState", "input")

In my scenario, inputs are received from the server side. However, some of these state inputs are not present in the Rive file. As a result, a crash occurs with the following error:

app.rive.runtime.kotlin.core.errors.StateMachineInputException: No StateMachineInput found with name input How can I handle this situation.

umberto-sonnino commented 3 months ago

Hi @harisAsterbyte, here are a couple of potential solutions:

harisAsterbyte commented 3 months ago

@umberto-sonnino looking for second solution. can you give me the detail solution based on this coderiveFile?.fireState("GirlState", "input")

umberto-sonnino commented 3 months ago

@umberto-sonnino looking for second solution. can you give me the detail solution based on this coderiveFile?.fireState("GirlState", "input")

I don't know much about your setup, but you can take a look at our tests to see how to grab the right references and adapt them to your use case!