Forum rules - please read before posting.

Built game choppier than game in editor

So I don't know if this is a Unity problem or an AC problem, but I figure I should ask anyway.

I am trying to prepare a demo for my game but I'm noticing that the built games (PC and webplayer as of now) have framerate issues only in certain spots-

There are only two scenes in which this happens, and it ONLY happens when the game is unpaused and there is no cutscene running. When the player is controlling the character with the cursor is when the framerate drops severely. Also, another instance is when a cutscene is running in the background, and even though player input is disabled, the same choppiness occurs.

Now, the confusing part is that this ONLY happens in the builds, and does not show up at all in the editor game view. In fact, in the game view it runs quite well.

I've searched quite a bit around google to see if this is a known Unity problem, and I've tried various things (using lower quality settings, enabling/disabling most of the build player settings, etc.) and I thought I was onto something when I checked the PC version output log and saw an inordinate amount of "no rigidbody attached" errors. I had seen several people note that the framerate in a build can dip significantly when outputting a lot of errors to the log. 

However, I went into the char.cs script and commented out the Debug.LogWarning ("No rigidbody attached"); and tried again, but no luck. Could this script still be causing the problem? If not, does anyone have any ideas? Thanks as always!


  • As part of some optimisation improvements, it just so happens that 1.32 removes the need to have Rigidbodys on Characters.  You still need them for Characters that are affected by gravity/collisions etc, but it'll be safe to remove them if not.  Hopefully that may help your issue.
  • That would be great, thanks. My gut tells me that is the problem, mainly because this is occurring in builds and not the game engine, where it sends out error reports to the log in a different way.
  • Thinking about it some more, is there a way to turn off all debug logging for a game build? I figure that unless I'm building a development build, the output log is nothing but a drain on processing power.
  • edited May 2014
    Okay so after some more testing, I'm not sure it has to do with rigidbodies after all. This happens in two scenes at three times in those two scenes, I'll describe the problem a bit better:

    1) Scene 1: it only happens when the player clicks on the screen. There is a very noticeable framerate drop for about a second after clicking. It's especially noticeable when the player character needs to turn to walk after clicking.  I had a large backgroud hotspot behind the set geometry, but I tried removing it and the problem persists. There is an NPC in the scene who previously had no rigidbody, so I tried both adding the rigidbody and unchecking the NPC script, but it didn't help.

    2) Scene 2 (main terrain/game overworld), part 1: The opening of the scene is a cutscene in which the player character and two NPC's are riding horses while the NPC's talk. The camera follows the player using the object: transform script (I modified the script so that transition time could be up to 100 seconds- i.e. changed 10f to 100f). The cutscene ends as soon as the dialogue ends, but the horses and camera continue moving until the player reaches a trigger. Player input is disabled for this period. 

    As soon as the cutscene ends, and the camera still moves, the framerate takes a massive hit. I don't have Unity Pro, and therefore no profiler, but I would estimate the FPS to be at around 4-5 during this period. As soon as the player hits the trigger, another cutscene begins and the FPS return to normal (around 40-50). 

    3) Scene 2, part 2: The trigger cutscene finally ends and the player has full control over the player character. As soon as the cutscene ends, again, the framerate dips to about 10 FPS, even while the player is doing absolutely nothing. However, when the player does click, the framerate seems to drop even further. 

    This terrain scene is separated into many different subscenes- the player walks to one trigger and moves to the next subscene, and the camera follows. So in this situation, the framerate goes back to about 40-50 FPS, as it is a cutscene again. The terrain scene has a lot of grass/trees and other details, but the fact that it seems to run quite smoothly during cutscenes suggests that the slowdown problem is script related, not graphics related. 

    Scenes 1 and 2 do not have much in common that the other scenes don't have. They have multiple cameras, but so do other scenes. They have NPCs, but again, so do other scenes. The only thing I can think of is that they both have "Basic Water" objects (found in Assets>Standard Assets>Water (Basic)) but I tried removing it from scene 1 and there was no change. Also, these two scenes are, spatially speaking, larger than any of the others. But if that is the problem, why do the slowdowns only occur during normal gameplay and not cutscenes. 

    Is there anything you can think of in the clicking/player movement scripts which might affect the game differently in the editor vs in a standalone build? Any other thoughts about this? 

    Ah, almost forgot, whenever I try to make a PC build, I get these three errors:

    Socket: connect failed, error: Operation has failed with error 0x2733: A non-blocking socket operation could not be completed immediately.

    connect failed

    Failed to connect to player ip:, port: 55130

    I assume this isn't causing my problem, but I thought I'd let you know. Thanks, as always!

    Edit: After yet more testing, it looks like this does happen in every scene, but to a much much lesser extent than in the scenes mentioned above. Also it only happens when the player clicks on the screen when in a non paused or cutscened state. And again, only in builds. The editor runs perfectly fine.
  • Are you using a terrain mesh for your pathfinding?  That may be the general cause, if your mesh is very complex, though I don't think it would account for the difference between build/editor framerates.  Post a shot of your navigation setup, if you could.

    A quick note about point 2): you could also use GameCamera settings to make the camera follow the player, without the need to transform it.

    It may also be down to an indefinitely-looping ActionList.  Inside the GameEngine prefab, look for the ActionListManager script and check the Show Active Action Lists box - this will display all lists running, and may help you figure out the cause, since you'll know what should be running and what shouldn't be.
  • 1- I am using navmesh segments which I have baked into a navmesh, with no terrain navmesh. Here is a shot of what it looks like so far:

    I intend to add on quite a bit to it throughout the game development, too.

    The navmesh in the first scene is quite simple compared to this, though it still consists of 5 different navmesh segments, which is more than any other scene (besides the terrain). Could that be the culprit? Too many navmesh segments causes slow downs in the built game?

    2- I noticed I could use that setting, but I wanted to get a situation where the camera moves slightly slower than the player, so that the played ends up "catching up" with the camera as it pans. Do you think moving the camera like this is causing problems? Either way, I got rid of this problem by separating my cutscenes a bit and then pausing gameplay during all of them, so that it is constantly paused. That way it does not slow down during the camera moving anymore.

    3- I actually checked this previously and there are no actionlists running while the slowdows occur in the terrain scene. In scene 1, I have a "timer" cutscene running which adds 1 to a variable called time every second, but I have this running in other scenes too and it is not causing a problem there.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.