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

Default SayDialog will drop frames first time italic is called. #125

Closed
unknowndevice opened this issue Jul 28, 2015 · 14 comments
Closed

Default SayDialog will drop frames first time italic is called. #125

unknowndevice opened this issue Jul 28, 2015 · 14 comments

Comments

@unknowndevice
Copy link

I've noticed that the first time italics is called with the default SayDialog prefab it will lose frames on a build. I think this is happening because "Exo2-Regular" has no italics font packaged.

This error stops happening if you switch to "Amaranth-Regular" which has the italic font bundled.

@chrisgregan
Copy link
Contributor

Ah I hadn't noticed that before, thanks for pointing it out. Any other ideas for a fix on this one? I guess we could swap it out for a different font that has an italic set included, would mean anyone upgrading to latest version of Fungus would need to set their font references again though. What about changing the Character font setting to Unicode instead of Dyamic - does that have the same problem?

@movrajr
Copy link

movrajr commented Jul 30, 2015

My standalone build has framedrop the first time the dialog is displayed in a 3D scene where the camera is rotating, even after replacing the italic "Exo2-Regular" with normal Arial. In the Editor playback is smooth even though the profiler indicates a 25 ms spike: 14 ms in Block.ExecuteBlock() and 10 ms in Canvas.SendWillRenderCanvases().

@KumoKairo
Copy link

This is some font caching stuff, I usually add a letter or two of every style on an invisible (alpha 0) text component at the start of the scene so it can pre-cache it when the scene is loading.
It's smooth in the editor because it somehow retains cache between Plays

It may be not the most elegant way of doing it, but when I stumbled upon this problem myself, this is the only solution I've been able to find.

@movrajr
Copy link

movrajr commented Aug 1, 2015

@KumoKairo Thanks for that trick, going to try that. I'm not sure if the reason is specifically font caching or just the inefficiency of enabling Canvas objects in general. Because the hiccup now occurs when a second canvas with the default arial font is enabled. Whatever the cause, enabling Canvases on startup, making them alpha 0 and fading them in on demand could indeed be the way to go for now.

BTW Unity 5.2, now in beta, introduces UI performance improvements. I was unable to test Fungus in the beta, because Unity crashes when starting the scene. I have submitted a bug report yesterday which Unity QA was able to reproduce.

@chrisgregan Italic Exo 2 is included here: http://www.fontsquirrel.com/fonts/exo-2

@movrajr
Copy link

movrajr commented Aug 1, 2015

@KumoKairo Setting all Canvases to use a single font (using Arial for now) and fading in the first one makes my scene smooth, even when toggling the second Canvas. 👍

@movrajr
Copy link

movrajr commented Aug 1, 2015

@KumoKairo I confirm your caching trick works too for a smooth scene with multiple fonts. Downside: there is a noticeable delay between launching the build and the scene starting. I'm going to play around with the font import settings.

@chrisgregan
Copy link
Contributor

Thanks for the suggestions, gonna try out the 5.2 beta to see if it fixes this issue, if not I'll see if there's a way for Fungus to cache the fonts automatically.

@movrajr
Copy link

movrajr commented Aug 1, 2015

Forgot to tell the result of a test project for the 5.2 beta I made earlier today. Added a rotating camera, removed the Flowchart and made a script to enable a custom dialog Canvas by pressing the space bar. When I run the standalone build and press space the scene freezes shortly again. So unfortunately not much has changed in that regard.

@chrisgregan If you're going to check out 5.2 beta, maybe you can see why the editor crashes when there's a Fungus flowchart in the scene and give QA a heads-up. There have been some reports about the beta crashing on scene start in combination with some assets that may be related. For example: http://forum.unity3d.com/threads/constant-crashes-on-play.338596

@chrisgregan
Copy link
Contributor

Hmmm, looks like I need Unity Pro to access Unity beta versions. :(

Can anyone provide more info on the issue with 5.2 beta? Error messages or screenshots would be very helpful.

Also I'm going to hold on implementing the workaround for this issue until we can check if it's already fixed in 5.2

@movrajr
Copy link

movrajr commented Aug 11, 2015

Last I tried the stuttering was still there in 5.2 beta. Maybe font caching is just something the user is expected to deal with. It's been that way for years: http://answers.unity3d.com/questions/149762/how-to-prepopulate-font-cache.html

As for the crash on playback, that's an issue many people have reported with other assets. Seems to be related to hidden gameobjects. http://forum.unity3d.com/threads/unity-5-2-beta-6-is-available.346422/

@chrisgregan
Copy link
Contributor

If someone wants to write a Cache Font command I'd be happy to add it in to the library?

For the crash bug, it sounds like we're not doing anything wrong and it's a bug in Unity that they're working to fix. Let's see if it's sorted out in beta 7.

@movrajr
Copy link

movrajr commented Aug 17, 2015

Crash bug should be fixed in a future release http://issuetracker.unity3d.com/issues/fungus-flowchart-crashes-unity-5-dot-2

@chrisgregan
Copy link
Contributor

Awesome - thanks for sending in the bug report!

@chrisgregan
Copy link
Contributor

I've added the Cache Font command as a requested feature in Trello, and will close this issue.

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

4 participants