Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Is it just me or does Unity feel slow?

Discussion in 'General Discussion' started by DexRobinson, Jun 20, 2014.

  1. DexRobinson

    DexRobinson

    Joined:
    Jul 26, 2011
    Posts:
    594
    When I am playing my games they always feel a bit slow. Maybe it's my coding, maybe it's the graphics or the hardward but I always feel like Unity is the main culprit. I am mainly talking about mobile devices but it still shows up on PC as well. I know Unity is an amazing tool but I can't help but wonder if there is something that is causing it to slow down. Games like Dead Trigger and Monument Valley feel smooth, but whenever I publish something it always feels sluggish. I am not looking for tip and tricks to increase my performance as I have read everything under the sun about it, but I am just wondering is there something inside of Unity that drains resources in order to run.

    I wonder if there could be a lite version of Unity that didn't have all the bells and whistles that could run better and be a smaller download size as well.
     
  2. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,083
    Are you sure it's the engine and not how you've set up your character and camera motion?
     
  3. Windexglow2

    Windexglow2

    Joined:
    Sep 23, 2012
    Posts:
    90
    Somewhere between nothing and what you have, something is eating performance. Unity will always be slightly slower than an engine designed for a specific game, but unless you are really pushing the limits it won't be noticeable.
     
  4. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    That makes it pretty clear it's not a fault with Unity itself then.

    Nope.

    --Eric
     
  5. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    8,194
    Unity is not a AAA game engine, also all your code is .net code or mono code that is being translated to native code. Add to this the fact that Unity is not a multi-core game engine and you have to realise that Unity is not the most performant of game engines compared to modern multi-core AAA engines.

    Every time you access a transform or rigidbody you are transmitting the data between the Unity C/C++ single core engine and your Mono scripts. You need to be storing every reference to the game engines data and using the profiler liberally to improve your games speed.

    Also there is .Net threading which you can use outside of the Unity game engine and it's components to speed up complex operations e.g. game AI.

    http://forum.unity3d.com/threads/unity-benchmark-v0-1.151813/
     
    Last edited: Jun 20, 2014
  6. Devil_Inside

    Devil_Inside

    Joined:
    Nov 19, 2012
    Posts:
    1,117
    Are you talking about slow as in slow-mo? Or slow as in low fps?
    If you have a high and constant fps but the movement still feels jerky, try applying some easing to your movement functions. Not only will this make the movement smoother, it will also make it more natural
     
  7. Deleted User

    Deleted User

    Guest

    Lerp Lerp Derp Lerp, Quaternion.
    Vector Lerp Derp Smooth Delta..

    Long distance real time shadows......



    NO! On the (w)hole it feels good to me. Anyway, what sort of FPS you getting etc? Or the actual thing that matters what's your MT and RD latencies?
     
  8. JamesLeeNZ

    JamesLeeNZ

    Joined:
    Nov 15, 2011
    Posts:
    5,616
    I have noticed terrains can appear laggy, even when running at over 3000 fps.

    pretty sure its not the camera or the code.
     
  9. Rodolfo-Rubens

    Rodolfo-Rubens

    Joined:
    Nov 17, 2012
    Posts:
    1,197
    I think this is kinda wrong to say.. I mean..
     
  10. Deleted User

    Deleted User

    Guest

    I've noticed stutters but not slowdowns as such, if you get what I mean. Which I didn't get in CryEngine or UE4.. Tried motion blur etc. to try and smooth it out but doesn't really work even with the framerate being consistant. It's not bothered me enough to complain too much yet.

    @rodolfo_r

    Well that can be debated dependant on what you're doing, but it's not the thread :D
     
  11. goat

    goat

    Joined:
    Aug 24, 2009
    Posts:
    5,182
    Dead Trigger is a slow game.
    Uh, the elephant in the room that everybody is ignoring is that those games, Dead Trigger and Monument Valley have both been optimized and stripped and have been published with a different version of Unity than the poster is using to code his GPU intimidating Recipe Book that is making Unity seem so slow.

    Isn't that convenient?

    But that's OK.

    OP, Unity is never the problem. Never.
     
  12. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Code stripping doesn't make it go faster, it just reduces the size of the executable. Increasing speed can be done by using "fast but no exceptions" in the build settings. And no, it's not a different version of Unity. It's the exact same version that everyone else has.

    --Eric
     
  13. DexRobinson

    DexRobinson

    Joined:
    Jul 26, 2011
    Posts:
    594
    Thanks for your feedback everyone. I know Unity can be tweaked and optimized to run anything fast but even when I put in a single character with a quad for terrain it's not that responsive. Unity is an amazing tool I am not questioning weather it is or not is, but using such a simple scene you would think it would be able to turn on a dime so to speak without the need to do any sort of optimizing.

    I know it's not the same thing, but using cryengine, it runs smooth out of the box without the need for any sort of optimizing. I know Unity is a more general engine, but too me it runs slow if your trying to do any sort of game unless you do some of the things you guys are talking about.

    I am not trying to complain or be negative, I just want Unity to be the best it can be and while it is in a lot of areas I still think it could use some work maybe with Unity 5 these issues will go away.
     
  14. Deleted User

    Deleted User

    Guest

    Well that's a big issue, it will never run like CE. For a start everything is dynamic and optimised to run that way, they have clustered algorithmic data streaming, all there shaders are optimised to work with CE and you don't get access to them. They don't even use Nvidia Phsyx, CryTek use their own implementation, theres a metric shed ton of reasons why!.

    Have you tried baking and cutting shadow distance to something like 10 in the player? Have you profiled spikes?
     
  15. chrisall76

    chrisall76

    Joined:
    May 19, 2012
    Posts:
    667
    If your putting a single character and a quad down and it's still lagging, it's ether how your coding that character or your PC. I can put characters and a quad in a scene without much performance impact. Probably do want to post the webplayer here and see if anyone can run it fine.
     
  16. DexRobinson

    DexRobinson

    Joined:
    Jul 26, 2011
    Posts:
    594
    Like I said, I know it's not fair to compare the two, and the issue isn't with x scene doing x thing. It's more of an overall feel of performance. I know it's not my computer that sucks, but some Unity projects just have an overall choppiness to them. Maybe it is something I am doing or not doing, but I just feel like overall Unity is just slower then some of the other engines out there. While Unity is light years easier to understand and use, I just feel that some of that ease of use is hindering performance where it could really benefit from. I mean you include UnityEngine.h at the top of your code and presto you have everything under the sun. While it's great that it's that easy, what if there was a way to include specific files for specific tasks and not be forced to use the "entire" engine.I am not a game engine architect nor that knowledgeable about how Unity is structured so maybe I am just talking out of my ass lol.
     
  17. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    That sounds like a problem with either your movement code, or else you have some problem with your input. (Which may or may not be Unity-specific in your case, but certainly doesn't apply to everyone because I've never seen any such issue here.) It's not inherently unresponsive. Having the "entire engine" is no issue because the stuff you're not using takes up almost no CPU time anyway.

    --Eric
     
  18. Per

    Per

    Joined:
    Jun 25, 2009
    Posts:
    460
    What does the profiller say?
     
  19. DexRobinson

    DexRobinson

    Joined:
    Jul 26, 2011
    Posts:
    594
    Thanks for the clarification I wasn't sure how much it really used. I mainly use the movement code that is on the script page(without using get component in the update of course). Character Controller and such.
     
  20. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,614
    What do you mean by "not that responsive"? Do you mean there's input lag? Low framerate? Stutters?

    People can yammer on all they want about engine comparisons and whatnot, but at the end of the day this comes down to "can your game produce the output for a given input fast enough that a human can't percieve the latency?" And in my experience any engine worth its salt will do fine at that, even on pretty mediocre hardware.

    What frame rates are you getting? If it's 30+ then it's unlikely that you're feeling unresponsiveness as a result of engine performance, because there's a (theoretical maximum, assuming no post-processing) of 1/30th of a second between an input being given and the game rendering the updated output. While 30fps won't feel as silky as 60fps it's hardly something I'd call "unresponsive".

    Common things that can make it unresponsive:
    - Not using input on the same frame you receive it. Script execution order is key here in Unity, especially if you've got a chain of actions happening based on input. LateUpdate is enough to solve trivial cases, but if you've got a chain of more than 2 things ultimately responding to the same input you'll need to do more than that.
    - Input polling rate on mobile devices. It's usually not the same as your frame rate.
    - Input smoothing, or motion smoothing/acceleration.
    - Ineffective use of the physics system with physics-based motion.
     
  21. Aiursrage2k

    Aiursrage2k

    Joined:
    Nov 1, 2009
    Posts:
    4,835
    I guess it will depend on what your trying to do, you have to do some optimization s to get it running smoothly. If your trying to making an FPS game then you are better off using one of the engines that have been optimized for that type of game. With unity you have to start from scratch which makes it easy to make any kind of game you want whereas other types of engines are more tailored for certain types of games which is going to make it harder to do something off the beaten path.try making an RPG with the original Starcraft, I remember kids used to do it -- but why when there are so many engines designed for that -- RPG maker. You want to make a more straightforward FPS better off with cry engine etc
     
    Last edited: Jun 21, 2014
  22. hatless

    hatless

    Joined:
    Dec 15, 2010
    Posts:
    48
    Jesus, but there is a lot of cringing inferiority complex going in the Unity community ("Unity is not an AAA game engine"... the F*** does that even mean? Is there a Bureau judging if something is AAA? ("I'm sorry, this is only an 'AA' engine. DISQUALIFIED! *bigrubberstamp*))

    Ahem.

    Obvious question: Are you running it in the editor or as a executable file? The editor adds a lot of extra stutter that doesn't exist in the finished product (for whatever reason.)
     
  23. Devil_Inside

    Devil_Inside

    Joined:
    Nov 19, 2012
    Posts:
    1,117
    I don't think OP is talking about low framerates or performance problems, but rather jerky movement and rotations, which is due to the lack of input smoothing in standard Unity assets. Try adding some easing/lerping and see if that helps.
     
  24. DexRobinson

    DexRobinson

    Joined:
    Jul 26, 2011
    Posts:
    594
    Yes this is one of the issues. I guess I shouldn't relay on such easy ways to code player movement.

    Hmm, I never thought about script execution order before. I have seen it but never once thought to change it. I'll look more into that for future projects. Same with LateUpdate(), I have seen it but never thought to use it.

    Also, I think Unity can be a AAA engine, but you need to understand how to make it that way as you can't just import assets and have them work out of the box without the need to optimize things.

    Off topic question: Why does Unity not need to be built in order to run(while in the editor I mean). Just always baffled me that I could hit play and see all my code changes immediately.
     
  25. Deleted User

    Deleted User

    Guest

    We've been over this a million times, AAA refers to an amount of money not really the game you're making. For some high end large / graphically intensive games Unity as is can't cut it, as rare as it is that people make these sort of games anyway.

    Unity 5.0 will address most of these issues, that's all there is too it.
     
  26. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    It does need to be compiled; that's what the little spinny thing in the lower-right corner means. If you save a script you need to wait for it to be compiled first before you can use it, so it's not immediate. (But if you don't have much code then it can be very fast.)

    --Eric
     
  27. CarterG81

    CarterG81

    Joined:
    Jul 25, 2013
    Posts:
    1,773
    I wouldn't be surprised if this issue, such a big one too, was a serious problem and unacceptable for many of us working in game dev. Just recently, there was a pretty big (totally unacceptable) problem with basic 2D rendering. A problem no other 2D game engine I've ever used had, and I've used nearly all of them.

    Fortunately, it was fixed in the latest 4.6 update, and is now solved!

    So it is certainly 100% believable that this will be fixed in Unity 5.0, like ShadowK suggests. We can only hope, anyway.
     
  28. firalt

    firalt

    Joined:
    Jun 5, 2014
    Posts:
    9
    A lot of how a game feels has more to do with how you're handling input and animations and less to do with the engine itself. Given no major assumptions, try setting your inputs so that button presses are closer to being binary. The default input responses aren't very good. If you're using custom animations try animating in a more procedural, responsive way (Overgrowth has a nice video where they describe their process if you want an example). Maybe check to make sure you're not running too much on updates (basic performance profiling stuff). Take the time to fine tune your character controller. Depending on how you handle your controller directly effects your game's feel (that should be pretty obvious). A game using forces to push a physical cube around will feel different from a game using fixed translations on every button press. There are a ton of ways to interpolate positions over time, maybe look at iTween for ideas.
     
  29. 0tacun

    0tacun

    Joined:
    Jun 23, 2013
    Posts:
    245
  30. KheltonHeadley

    KheltonHeadley

    Joined:
    Oct 19, 2010
    Posts:
    1,685
  31. Frpmta

    Frpmta

    Joined:
    Nov 30, 2013
    Posts:
    479
    Thanks to this and this thread I finally know I am not insane. Thought the stuttering was just me.
    EDIT: Thought smooth motion was something I could take for granted and not have to make sure it works in code. Glad to know it is something we easily manage in code.
     
    Last edited: Jun 21, 2014
  32. Deleted User

    Deleted User

    Guest

    Simple way to test this, go take your animations and char and do a quick test in something like UE4. I always have a back up engine in case I believe it's Unity being screwy and I agree with the op, it's not a slow down but a stutter.

    Thing is it's more noticeable when you spend every moment with Unity day in and day out.
     
  33. RJ-MacReady

    RJ-MacReady

    Joined:
    Jun 14, 2013
    Posts:
    1,718
    < ---This

    I can't argue with your technical details, as in regards to them I know not of which I speak. However, isn't that really, really subjective? I'm not going to say that a game made in Unity could sell as many copies as it darn well pleases, if people are willing to buy it... but Minecraft is written in an interpreted language. Hate to be disagreeable, but this seems a tad bit like misinformation or to feed to the off notions that Unity is somehow this inferior thing, rather than what it is.
     
  34. RJ-MacReady

    RJ-MacReady

    Joined:
    Jun 14, 2013
    Posts:
    1,718
    Is it just me or does Unity feel slow?
    This is quantifiable, frame rate, velocity of objects in your scenes. It's all relative. But no, Unity can run at anywhere from 60-90 FPS if you're keeping your scene pared down and minimal. It's also important to note that you get lower FPS if:
    • You're testing in Unity vs. a standalone executable (from experience, standalone also has less incidences of hitching, etc)
    • You're not using Maximize on Play (from experience, for whatever reason... but still slower than creating a build)
    • Errors. Warnings. If you have a stack of 500+ errors or warnings being thrown, that can contribute to a slowdown.
    • Objects. Where are your objects? How many? How often are they instantiating? They all running scripts?
    • Rigidbody physics calculations. Ouch!
    Hope this somethings.
     
  35. KheltonHeadley

    KheltonHeadley

    Joined:
    Oct 19, 2010
    Posts:
    1,685
    Unity can run at any fps, not just 60-90.
     
  36. RJ-MacReady

    RJ-MacReady

    Joined:
    Jun 14, 2013
    Posts:
    1,718
    That's a pretty fair range to shoot for.



    Google searched, found this.

    I'm understand vaguely that this shows what people see at different FPS (hz, same concept). There is apparently nothing happening above 81-82 according to this chart, meaning light is not being captured and processed at all.

    e.g, fluorescent bulbs flicker at 10,000hz-40,000hz yet to your human eye they appear as solid light. So it is with your FPS in your game. Above a certain FPS, you literally are just blocking it out in your mind, blending it with the last frame or the next frame.

    Plus if your game's FPS is higher than your monitor's refresh rate, you could potentially run into some ugly issues (I've seen it before, still don't fully understand it). Basically your monitor outputs a half drawn image. Ugly. I believe it's called tearing.

    Plus a lot of monitors are set at 60-72, anyway.

    So there's a reason for my seemingly arbitrary 60-90.
     
  37. KheltonHeadley

    KheltonHeadley

    Joined:
    Oct 19, 2010
    Posts:
    1,685
    I'm not saying otherwise. The way you worded your first comment it seems as if you said Unity can ONLY run at 60-90.
     
  38. RJ-MacReady

    RJ-MacReady

    Joined:
    Jun 14, 2013
    Posts:
    1,718
    "In the video game industry, AAA (pronounced "triple A") is a classification term used for games with the highest development budgets and levels of promotion.[1][2][3][4] A title considered to be AAA is therefore expected to be a high quality game and to be among the year's bestsellers"

    Well, hell, 99.99% of all games made cannot be described as "AAA", including those made by reputable game developers. :/
     
  39. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Actually not; it's written in Java.

    That's incorrect; there's no particular defined upper limit in terms of frames per second perception. From first-hand experience, 120 is clearly better than 60, and yes 120Hz gaming monitors are a thing, for a reason. Probably more than 120fps is not all that super noticeable, but then I'd have to see it to be sure.

    --Eric
     
  40. RJ-MacReady

    RJ-MacReady

    Joined:
    Jun 14, 2013
    Posts:
    1,718

    http://stackoverflow.com/questions/1326071/is-java-a-compiled-or-an-interpreted-programming-language

    "Java uses a two step compilation process. Java source code is compiled down to "bytecode" by the Java compiler. The bytecode is executed by Java Virtual Machine (JVM). The current version of Sun HotSpot JVM uses a technique called Just-in-time (JIT) compilation to compile the bytecode to the native instructions understood by the CPU on the fly at run time."

    ?

    Okay.

    Just one source: http://www.100fps.com/how_many_frames_can_humans_see.htm

    Claims air force did tests with flashing lights, people can perceive anywhere from 1/200th-1/500th of a second of a blink of light, an awareness of something.

    From Game Feel

    So on the one hand your brain can sense changes in light at 500 FPS, but can only recognize images in the 200+ FPS range (for fighter pilots, I'd assume) and can only respond to what's happening at an average of about 32-33 FPS for pretty much everybody.

    Yet you can "see" motion at 10 FPS, watch movies at 24 FPS and for years played games at 30 FPS or less. Now it's 120 hz minimum refresh rate or go home...

    At 120 FPS I believe they could be throwing subliminal messages at you every 15th frame and you wouldn't even notice.

    EDIT: ... And I am right. 3D TV's operating at 120 hz are capable of generating split-eye 3D imaging in which alternating frames fire off different images to be received by either the left or right eye delivered at 60 fps to your retinas, this is perceived as a solid image with no breaks by your eyes.

    And since most media viewed on a TV is not 120 FPS the televisions literally insert duplicate frames in between as filler, nobody notices.

    I bet that if you were playing a game at 120 FPS you could see a difference between 120 and 60 but I believe past the high 80's it all really amounts to the same, though I would be fascinated to be proven wrong.

    If you're truly interested in the subject,
     
    Last edited: Jun 22, 2014
  41. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,614
    To be clear, I wasn't talking in particular about the execution order controls in a project's settings. That's just one approach to handling the issue, and it's a high-level, broad grained one that may not be suitable for all use cases.

    Another approach is to not use Unity's built-in callback functions (Update and co.) but instead have a 3rd party script call into things that are order-dependent. Another is to use events (eg: player movement fires a "PlayerMoved" event, which the Camera's controller listens for and responds to).
     
  42. TylerPerry

    TylerPerry

    Joined:
    May 29, 2011
    Posts:
    5,577
    Exactly, thats not interpreted.
     
  43. RJ-MacReady

    RJ-MacReady

    Joined:
    Jun 14, 2013
    Posts:
    1,718
    Oh. I guess that makes sense, in a way. Actually. I still think of it as interpretation. There's argument to be had there, though.
     
  44. TylerPerry

    TylerPerry

    Joined:
    May 29, 2011
    Posts:
    5,577
    Yeah, I can see how it can be confusing "interpret" isn't really the best word for it, but I suppose when it was invented JIT didn't exist. Java could be considered interpreted if it was never got JIT compiled in fact some JVM are interpreters and in the past that was common. Interpreted languages are never compiled.
     
  45. RJ-MacReady

    RJ-MacReady

    Joined:
    Jun 14, 2013
    Posts:
    1,718
    Well, I don't like admitting I'm wrong even when I'm dead wrong. I'll admit to being 1/2 wrong.
     
  46. RJ-MacReady

    RJ-MacReady

    Joined:
    Jun 14, 2013
    Posts:
    1,718


    Is there an Official Unity Tutorial on integrating events and delegates?
     
  47. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    8,194
    The key points here are the fact that your games code is non native and single threaded*. All top level game engines produce native code and are multi-threaded. For instance even on a mobile device a Unity game can be limited in it's performance due to the fact that only a single core* will be used.

    Just power up a Unity game and check Task Manager, notice how the processing will max out at a percentage of your CPU power well below the 100% possible.

    Thankfully Unity are moving the game engine to a multi-threaded job system in 5 but it looks like this will be locked down and only run the game engines jobs not our scripts or code.

    Unity are also moving to a C++ build system which means that all your code regardless of platform will eventually be compiled native code.

    *Unity does do some light multi-threading for some sub-systems.
     
  48. hatless

    hatless

    Joined:
    Dec 15, 2010
    Posts:
    48
    All 'top level' engines have a native core and scripts that run on it, same as Unity.

    You can already write multithreaded code, using the mono multithreading API that is right there and has not gone anywhere.

    Unity already runs core, graphics and sound on different threads, which is about as far as you can parallelise an engine before you start causing more problems than you've solved.

    Again, what is it with the cringing inferiority complex in the Unity community?
     
    angrypenguin likes this.
  49. TylerPerry

    TylerPerry

    Joined:
    May 29, 2011
    Posts:
    5,577
    It's not everyone. All other engines suck.
     
    Beennn and Wacky-Moose like this.
  50. Deleted User

    Deleted User

    Guest

    It's hilarious that people deny Unitys shortcomings when Unity themselves are releasing a new version to rectify the problems. 64-bit editor anyone? Most people here don't make open world RPG's / MMO's so it's not a problem for them.

    A lot of people have hit frustrating bugs which has a negative view of opinion as well, there's a 28 page thread on the matter here: http://forum.unity3d.com/threads/official-how-can-we-serve-you-better.245901/
     
    Last edited by a moderator: Jun 22, 2014
    TheSniperFan and RJ-MacReady like this.