Hey,
So I noticed for a long time that, every time I go up to an NPC to initiate a dialogue, I get a mini lag spike before the dialogue UI window appears.
In the Editor, this lag spike happens only once, but in a built game, I get this lag spike every time I initiate a conversation with an NPC.
Another issue in the built game is that, each time I get to a player choice, where nodes have to be spawned, depending on how many choice options I have, the game will have a lag spike as well.
I have moved to a better prefab spawning system that was covered by Brian in a different post of mine, but still, I remained with this issue.
You can imagine how annoying it is to experience those lag spikes every time you go and talk to an NPC, or have 3-4+ more choices to spawn. It makes you not want to talk to any NPC ever again.
While I can’t see why in a built game, those lag spikes happen every time that I talk to an NPC and when choice prefabs have to be enabled (because in the editor it happens only once), I took a quick look at the Profiler when I first talked to a dialogue NPC to see what happens.
I discovered that somehow, the PlayerConversant did something like “Loading.ReadObject”. When I checked the details, it seems that the 1st time I talk to an NPC, somehow the game is loading all of my resource folders.
Is this because this is needed in order to know which dialogue nodes to get / load?
I don’t really know if this resource loading is happening all the time in a built game and it’s why the game stutters, but I just found it strange.
Also, I know I have to go into my project files and tidy up a bit, but I still do not understand why those stutters occur.
Here is a quick screenshot of the Profiler:
Thanks!