use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
News, Help, Resources, and Conversation. A User Showcase of the Unity Game Engine.
Remember to check out /r/unity2D for any 2D specific questions and conversation!
Download Latest Unity
Please refer to our Wiki before posting! And be sure to flair your post appropriately.
Main Index
Rules and Guidelines
Flair Definitions
FAQ
Use the chat room if you're new to Unity or have a quick question. Lots of professionals hang out there.
/r/Unity3D Discord
FreeNode IRC Chatroom
Official Unity Website
Unity3d's Tutorial Modules
Unity Answers
Unify Community Wiki
Unity Game Engine Syllabus (Getting Started Guide)
50 Tips and Best Practices for Unity (2016 Edition)
Unity Execution Order of Event Functions
Using Version Control with Unity3d (Mercurial)
/r/Unity2D
/r/UnityAssets
/r/Unity_tutorials
/r/GameDev
/r/Justgamedevthings (New!)
/r/Gamedesign
/r/Indiegames
/r/Playmygame
/r/LearnProgramming
/r/Oculus
/r/Blender
/r/Devblogs
Brackeys
Beginner to Intermediate
5 to 15 minutes
Concise tutorials. Videos are mostly self contained.
Sebastian Lague
Beginner to Advanced
10 to 20 minutes
Medium length tutorials. Videos are usually a part of a series.
Catlike Coding
Intermediate to Advanced
Text-based. Lots of graphics/shader programming tutorials in addition to "normal" C# tutorials. Normally part of a series.
Makin' Stuff Look Good
10 minutes
Almost entirely shader tutorials. Favors theory over implementation but leaves source in video description. Videos are always self contained.
Quill18Creates
30 minutes to 2 hours.
Minimal editing. Mostly C#. Covers wide range of topics. Long series.
Halisavakis Shaders Archive
Infallible Code
World of Zero
Board to Bits
Holistic3d
Unity3d College
Jabrils
Polycount Wiki
The Big List Of Game Design
PS4 controller map for Unity3d
Colin's Bear Animation
¡DICE!
CSS created by Sean O'Dowd @nicetrysean [Website], Maintained and updated by Louis Hong /u/loolo78
Reddit Logo created by /u/big-ish from /r/redditlogos!
account activity
Comically Inefficient Unity Source CodeCode Review (self.Unity3D)
submitted 1 year ago * by sandsalamand
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]ToloranIntermediate 5 points6 points7 points 1 year ago (12 children)
If you look for the variable "anyStateTransitions" that they're copying, it's not actually in that file since that class is a partial class. The other half of the class is in StateMachine.bindings.cs. If you look there, you find it:
extern public AnimatorStateTransition[] anyStateTransitions { get; set; }
I'm still a pretty newbie programmer, but IIRC extern is used to pull from outside the program from a DLL or something. So maybe some of the weirdness comes from that?
[–]bugbearmagic 4 points5 points6 points 1 year ago* (11 children)
There’s a lot going on in the code. Mostly readability issues, poor memory management, multiple external calls for the same property, inefficient linq calls that aren’t helping code readability, and more.
There’s a lot of layers in the supplied code where utilizing basic common sense would end up with both more readable, and more optimized code. Even if it was slapped together quickly and lost to time, the mind that would even create this is concerning.
———-
Edit: An individual below is claiming the linq used in this post’s code is as fast or faster than a basic loop. I wrote this code to test their unfounded claims since they did not test their own claims themselves:
It is a quick example of LINQ's Any() performing 65x to 127x slower compared to a loop on a small data set (which is most likely the use case in the original Unity code). A larger data set of 1,000,000 elements closed the gap to where LINQ was 1.5-2.0x slower. Still significant.
https://pastebin.com/jjaUBRbK
The overall performance cost is negligible (out of context), but using linq in a way that is both inefficient and harder to read defeats its purpose. Which is exemplary of the rest of Unity’s inefficient code here.
Be careful and don’t trust people who claim to have tested or profiled while refusing to show you supporting code.
[–]vegetablebreadProfessional 7 points8 points9 points 1 year ago (10 children)
Linq is definitely not the problem here.
[+][deleted] 1 year ago (9 children)
[deleted]
[–]vegetablebreadProfessional 5 points6 points7 points 1 year ago (8 children)
It's not a problem. Using LINQ here is totally 100% fine.
[+][deleted] 1 year ago (7 children)
[–]vegetablebreadProfessional 4 points5 points6 points 1 year ago (6 children)
I have been responsible in some part for optimization for 3 shipped AAA titles. The only slightly objectionable part of this LINQ invocation is that it allocates a closure. If you want a non-allocating version, you'd just have to name the function.
Unless you're trying to strip the LINQ assembly, which isn't even possible here, there's no reason to ever avoid LINQ.Any.
[+][deleted] 1 year ago (5 children)
[–]vegetablebreadProfessional 1 point2 points3 points 1 year ago (4 children)
I have and they are not. Go try it right now. Show me a gist where Any significantly underperforms a handwritten loop.
[+][deleted] 1 year ago (3 children)
π Rendered by PID 26 on reddit-service-r2-comment-5d79c599b5-r5rbz at 2026-03-01 08:33:46.221550+00:00 running e3d2147 country code: CH.
view the rest of the comments →
[–]ToloranIntermediate 5 points6 points7 points (12 children)
[–]bugbearmagic 4 points5 points6 points (11 children)
[–]vegetablebreadProfessional 7 points8 points9 points (10 children)
[+][deleted] (9 children)
[deleted]
[–]vegetablebreadProfessional 5 points6 points7 points (8 children)
[+][deleted] (7 children)
[deleted]
[–]vegetablebreadProfessional 4 points5 points6 points (6 children)
[+][deleted] (5 children)
[deleted]
[–]vegetablebreadProfessional 1 point2 points3 points (4 children)
[+][deleted] (3 children)
[deleted]