Game freeze when use OnTrigger2D only the first time.

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
OscarLeif
Posts: 6
Joined: Mon Sep 02, 2019 11:40 pm

Game freeze when use OnTrigger2D only the first time.

Post by OscarLeif »

Well this is my issue I'm working on a scene where my player trigger a collider2D and then a conversation start.
the game freeze for a very short time.
After only the first start dialogue the game will not freeze anymore.

I'm using the "Focus Template Standard Dialogue" I made some changes by replace the Text component to TextMeshPro components I remove some Horizontal and vertical Layout Group.


I check the profiler and this is what happens
profiler.PNG
profiler.PNG (45.47 KiB) Viewed 806 times
Not sure how can I improve this, the only way to avoid this is by starting a conversation on Start method, but in my case I'm not using that.
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: Game freeze when use OnTrigger2D only the first time.

Post by Tony Li »

Hi,

Inspect the Dialogue Manager and tick Other Settings > Preload Resources. This may help.
OscarLeif
Posts: 6
Joined: Mon Sep 02, 2019 11:40 pm

Re: Game freeze when use OnTrigger2D only the first time.

Post by OscarLeif »

I forgot to upload my dialogue System controller.
Ok this is my setup of the Dialog System Controller.
Dialogue.PNG
Dialogue.PNG (68.66 KiB) Viewed 803 times
I try with another Templates, the result is the same.
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: Game freeze when use OnTrigger2D only the first time.

Post by Tony Li »

I recommend leaving the Debug Level at Warning. Otherwise you will miss warning messages about problems that might cause game freezes.

Try setting the Dialogue System Trigger to OnEnable, and disable the component. After entering play mode, manually enable the component in the inspector. Is there still a delay?

If yes: The delay is probably in the conversation or setting up the dialogue UI. Check for any warning or error messages. Do the nodes linked from <START> have a lot of Conditions?

If no: The delay is probably in your physics setup.
OscarLeif
Posts: 6
Joined: Mon Sep 02, 2019 11:40 pm

Re: Game freeze when use OnTrigger2D only the first time.

Post by OscarLeif »

I made the test. I change the trigger to Enable.
While the freeze time is more short. it still have freeze time.
I also upload my conversation dialogue I think it's not super complex.
I'm also using Unity 2019.2.3f1
dialog_sequence.PNG
dialog_sequence.PNG (147.94 KiB) Viewed 800 times
The only solution to avoid this freeze, is when I start my scene I just start an empty dialog it will show the dialog with no text and it will fade, then when I trigger my first dialog it will not have that freeze time.

I will check what more I can do to improve this solution.
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: Game freeze when use OnTrigger2D only the first time.

Post by Tony Li »

Try changing the CPU details dropdown from Timeline to Hierarchy, and turn on Deep Profile. Then drill down into the hierarchy on the frame that lags and try to identify what it taking the most ms.
Post Reply