Need help in optimization

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
nishant
Posts: 55
Joined: Mon Sep 21, 2015 3:16 pm
Location: Canada
Contact:

Need help in optimization

Post by nishant »

Hey ,
I was trying to optimize my code and found that DialogueSystem causes spikes in the game.
This happens when I start a conversation from script
using
DialogueManager.StartConversation("conversation name");

Is this not the proper way to start conversation ??
I am also attaching a screenshot for reference
Attachments
LagSpike.jpg
LagSpike.jpg (169.22 KiB) Viewed 803 times
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: Need help in optimization

Post by Tony Li »

Hi Nishant,

You can reduce the load of ConversationModel.SetParticipants() by specifying GameObject transforms:

Code: Select all

DialogueManager.StartConversation("conversation name", actor.transform, player.transform);
Otherwise SetParticipants() will try to find appropriate GameObjects in the scene using the expensive Tools.GameObjectHardFind(), which examines every GameObject in your scene.

If your participants aren't associated with GameObjects already, you can create empty GameObjects to pass to StartConversation().

Also, on the Dialogue Manager click Preload Resources. This will load the database and dialogue UI at the start. If it's not ticked, these resources are lazy-loaded the first time they're needed, which can cause a momentary spike.
nishant
Posts: 55
Joined: Mon Sep 21, 2015 3:16 pm
Location: Canada
Contact:

Re: Need help in optimization

Post by nishant »

Thanks ... As always your quick response fixed the issue :)
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: Need help in optimization

Post by Tony Li »

As always, happy to help! :-)
Post Reply