Page 1 of 1

Performance Spike Instantiating Dialogue System Trigger

Posted: Tue Dec 19, 2023 9:43 pm
by InferiorBrain
I'm experiencing large CPU performance spikes when instantiating prefabs that have a Dialogue System Trigger attached. Baseline CPU/Scripts is around 2.3 ms and it jumps to ~42 ms each time I instantiate a single prefab. If I remove the trigger it's around 7 ms (other scripts and effects run simultaneously).

Disabling the script has no impact, but removing it entirely prevents the spike. The are no actions included in the triggers.

Since I have object pools setup for these prefabs it's taking an eternity to load scenes.

On the Dialogue System Controller script I've checked Preload Resources and turned on Warm Up Conversation, each with no effect.

I have 8 Actors setup in the Dialogue Database (so far), no quests or locations, 6 variables, and 5 conversations.

https://ibb.co/D1YLfj1

Re: Performance Spike Instantiating Dialogue System Trigger

Posted: Wed Dec 20, 2023 8:52 am
by Tony Li
Hi,

What is the Trigger dropdown set to? Some trigger types -- such as OnStart, OnEnable, etc. -- need to run checks when starting up.

That said, version 2.2.42 has some optimizations to the Dialogue System Trigger's startup. Here's a patch with those optimizations:

DS_DSTriggerPatch_2023-12-20.unitypackage

Re: Performance Spike Instantiating Dialogue System Trigger

Posted: Wed Dec 20, 2023 9:00 pm
by InferiorBrain
Thanks for the quick reply. The Trigger dropdown is set to OnUse.

Installing the patch causes the following error to appear twice, once in line 167 and again in line 241:

Assets\Plugins\Pixel Crushers\Dialogue System\Scripts\Triggers\Triggers\DialogueSystemTrigger.cs(241,10): error CS1729: 'ConversationPopupAttribute' does not contain a constructor that takes 2 arguments

I'm running Unity 2022.3.15f1 and Dialogue System for Unity v2.2.41.1.

Re: Performance Spike Instantiating Dialogue System Trigger

Posted: Wed Dec 20, 2023 9:49 pm
by Tony Li
Hi,

There are some dependencies, so it'll just be simpler to PM you the package.

Future readers -- download version 2.2.42+ from the Asset Store.

Re: Performance Spike Instantiating Dialogue System Trigger

Posted: Thu Dec 21, 2023 8:49 pm
by InferiorBrain
That fixed the issue! Amazing support, thank you so much.

Re: Performance Spike Instantiating Dialogue System Trigger

Posted: Thu Dec 21, 2023 9:28 pm
by Tony Li
Glad to help!