Performance Spike Instantiating Dialogue System Trigger

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
InferiorBrain
Posts: 3
Joined: Tue Dec 19, 2023 9:20 pm

Performance Spike Instantiating Dialogue System Trigger

Post 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
User avatar
Tony Li
Posts: 22112
Joined: Thu Jul 18, 2013 1:27 pm

Re: Performance Spike Instantiating Dialogue System Trigger

Post 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
InferiorBrain
Posts: 3
Joined: Tue Dec 19, 2023 9:20 pm

Re: Performance Spike Instantiating Dialogue System Trigger

Post 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.
User avatar
Tony Li
Posts: 22112
Joined: Thu Jul 18, 2013 1:27 pm

Re: Performance Spike Instantiating Dialogue System Trigger

Post 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.
InferiorBrain
Posts: 3
Joined: Tue Dec 19, 2023 9:20 pm

Re: Performance Spike Instantiating Dialogue System Trigger

Post by InferiorBrain »

That fixed the issue! Amazing support, thank you so much.
User avatar
Tony Li
Posts: 22112
Joined: Thu Jul 18, 2013 1:27 pm

Re: Performance Spike Instantiating Dialogue System Trigger

Post by Tony Li »

Glad to help!
Post Reply