rive-app / rive-app/rive-unity

Encountering significant script execution time on StateMachine.advanceStateMachine and StateMachine.getReportedEventCount

Open
#135 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
205
Forks
22
PR merge metrics
No merged PRs in 30d

Description

We have a scene in which we are sometimes displaying several animating characters at once on a UGUI Canvas set to worldspace render mode. On modern desktop computers with fast CPU's, we are encountering significant CPU usage resulting in framerate drops from 60 to 40 with around 10 characters on-screen. On iOS and Android, we are seeing far worse results, with noticeable slowdown even on 3 or so characters. The majority of CPU time is spent within two function calls to the native libraries:

Image

StateMachine.advanceStateMachine specifically hits high CPU usage during LateUpdate

Image

StateMachine.getReportedEventCount spikes CPU usage during Update

We are observing the issue with the current Unity package release (0.3.9-canary.57), as well as with the latest tag (v0.3.9-canary.170), which we pulled down manually and integrated for performance comparison tests.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by profiling StateMachine.advanceStateMachine during LateUpdate and StateMachine.getReportedEventCount during Update, comparing the 0.3.9-canary.57 release with v0.3.9-canary.170. Reproduce the scene with multiple animating characters on a worldspace UGUI Canvas across desktop, iOS, and Android. Done means the reported CPU spikes and frame-rate drops are substantially reduced.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, unity
Domain
game-dev, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.