inkle / ink-unity-integration

Unity integration for the open source ink narrative scripting language.
http://www.inklestudios.com/ink
Other
570 stars 99 forks source link

High CPU usage when Ink Player showning. #183

Closed chumomo closed 1 year ago

chumomo commented 1 year ago

Hi, with the Ink Player showing in the editor(as tab or window), the cpu usage of unity turns to higher which causes loud fan noise. I have to close the Player window or unfocus the Player tab to avoid the high cpu use.

And in asset folder, if I select an ink file to preview in the inspector, the same cpu issus happens too.

I'm using unity 2021.3.

Thanks!

tomkail commented 1 year ago

Thanks for the report! I think that the player window issue was the DrawSaveLoadPanel function, which was creating a save state each frame. This was so it could check if the user already had the latest save state in their system clipboard - but I agree that performance is the better tradeoff here! I've pushed that and a few minor performance updates to master. Let me know if they help! I noticed that performance still isn't great - takes about 6ms to draw either window on my M1 Mac. It's mostly down to Unity UI just being a bit slow. There are a few opportunities for us though - notably the "when was this ink file last edited" checks. We should probably try to run those less in a future pass.

tomkail commented 1 year ago

Also - it you have time, profiling the editor and letting me know what parts specifically are slow in your setup would be a great help.