background preloader

Practices & Performance

Facebook Twitter

How to tidy your Unity code by putting it in a DLL. The importance of Re-use Here’s a story that may sound familiar: You downloaded Unity, watched some tutorials on YouTube, and had a physics “game” running the same day.

How to tidy your Unity code by putting it in a DLL

Excited, you started writing the game you’ve always wanted to make. Possibly – bitten before when trying this with GameMaker etc – you thought to organize your source code: folders, subfolders, logically-named scripts, etc.Fast-forward a few months, and you have 50 scripts in 40 sub-folders, some of it re-usable, some of it hardcoded for your game. Hoooo-Kayyyy… Well, it’s not too bad. Wendelin Reich's Blog - C# Memory Management for Unity Developers (part 1 of 3) The following blog post, unless otherwise noted, was written by a member of Gamasutra’s community.

Wendelin Reich's Blog - C# Memory Management for Unity Developers (part 1 of 3)

The thoughts and opinions expressed are those of the writer and not Gamasutra or its parent company. [Note: This post presupposes 'intermediate' knowledge of C# and Unity.] I'm going to start this post with a confession. Although raised as a C/C++ developer, for a long time I was a secret fan of Microsoft's C# language and the .NET framework. About three years ago, when I decided to leave the Wild West of C/C++-based graphics libraries and enter the civilized world of modern game engines, Unity stood out with one feature that made it an obvious choice for myself. Unit testing at the speed of light with Unity Test Tools – Unity Blog. It’s time to tell a little bit more about NSubstitute library that ships with our Unity Test Tools and patterns of it’s effective usage.

Unit testing at the speed of light with Unity Test Tools – Unity Blog

Each software system consists of units of functionality. In object oriented languages, the minimal unit of functionality is a method. These methods usually depend on other methods and classes. If you have to test a method, some challenges will arise. First challenge is that external dependencies are not easy to set up, e.g. some objects with complex initialization might be required.Second challenge is that the test verifies specific execution path that requires certain behavior from other classes that are used.Finally, calling methods of external classes might lead to some changes in an environment that could not be rolled back, e.g. deleting a real record from a database.

Unit test is about testing unit of functionality in an isolated environment. There are five test double patterns: Dummy object, Test stub, Test spy, Mock and Fake. Dummy object Test Stub. 50 Tips for Working with Unity (Best Practices) About these tips (Edit: August 2016.

50 Tips for Working with Unity (Best Practices)

I have revised these tips. You can find the new list here.) These tips are not all applicable to every project. They are based on my experience with projects with small teams from 3 to 20 people.There’s is a price for structure, re-usability, clarity, and so on — team size and project size determine whether that price should be paid.Many tips are a matter of taste (there may be rivalling but equally good techniques for any tip listed here).Some tips may fly in the face of conventional Unity development.

Interesting things in Unity 4.5 you probably didn't know about. Well, as you all know Unity team has recently released Unity version 4.5 which brought us (according to Unity's web site): Over 450 bug fixes,OpenGL ES 3.0,Shader workflow boost,Smooth and natural 2D physics andSparse Textures.

Interesting things in Unity 4.5 you probably didn't know about

While 450 bugs fixed sounds amazing, shaders compilation was indeed terribly slow, I don't really care about OpenGL ES 3.0 (since I got an old iPhone 4s) and Sparse Textures is a good feature to explore on modern desktop GPUs, what I want to tell you about are those features and bug fixes buried in the massive Release Notes which you have probably missed but they are indeed very important. In no particular order. Hierarchy Window sorting New Hierarchy Window sorting - sorting of elements is now based on transform order instead of name. (Saving...) (Saving...) Unity 3D Best Practices: Physics. (Note: This is a follow-up post to a previous article on optimisations and best practices for Unity development).

(Saving...) (Saving...) Unity 3D Best Practices: Physics

This second part in our series will be entirely focused on Unity’s Physics engines. I’ll present, similarly to the previous article, simple topics which are easy to use and will optimise the physics engine usage. Let’s begin! All game objects, if not configured, are created on the Default layer where (by default) everything collides with everything. Performance Optimization Tips and Tricks for Unity. Game Programming Patterns. Hey, Game Developer!

Game Programming Patterns

Do you struggle to make your code hang together into a cohesive whole? Find it harder to make changes as your codebase grows? Feel like your game is a giant hairball where everything is intertwined with everything else? Wonder if and how design patterns apply to games? 46 Tips & Tricks for 2D mobile Performance in Unity. If this is your first jump into the world of Unity, my first tip (this one’s a freebie) is to stop trying to use it like other languages and environments.

46 Tips & Tricks for 2D mobile Performance in Unity.

You will be using GameObjects, you will be adding multiple script components, and you will have to think differently. When I first started, my approach was to largely ignore prefabs (or use them like Flash’s display list) and get a copy of Box2D running. Painful as it is to deviate, get ready to put in some work! Without further ado, let’s get started: