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
Need help in optimization
Need help in optimization
- Attachments
-
- LagSpike.jpg (169.22 KiB) Viewed 796 times
Re: Need help in optimization
Hi Nishant,
You can reduce the load of ConversationModel.SetParticipants() by specifying GameObject transforms:
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.
You can reduce the load of ConversationModel.SetParticipants() by specifying GameObject transforms:
Code: Select all
DialogueManager.StartConversation("conversation name", actor.transform, player.transform);
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.
Re: Need help in optimization
Thanks ... As always your quick response fixed the issue
Re: Need help in optimization
As always, happy to help!