This is a story of NullReferenceException part 2. If you haven’t read the part one, you can still do it here. Don’t trust GetComponent() GetComponent() is a commonly used function to access current GameObject’s component. Here’s a code snippet showing how to disable object’s renderer, so it is no longer visible in the game view. var renderer = […]
Tag: Tips
A Story of NullReferenceException [Part 1]
Once upon a time there was a little boy living with his mother alone between the mountains. They lived a peaceful life. One day the boy’s mother got very sick. The boy called for a doctor, the best in the valley. When the doctor finally came, he examined the woman. Unfortunately, there was only one medicine for […]
Mobile Optimization – Garbage Collector
What is the Garbage Collector? Let’s look at a definition on MSDN: The .NET Framework’s garbage collector manages the allocation and release of memory for your application. Each time you create a new object, the common language runtime allocates memory for the object from the managed heap. As long as address space is available in […]
Wrong Import Settings are Killing Your Unity Game [Part 2]
There are many things that may go wrong with your game development. Your models may have too many triangles for your target platform to handle, your algorithms may be too expensive for your CPU, and also you may be using too many materials so batching won’t work efficiently. These are difficult issues, and you as […]
Using threads with Unity
If you’re an experienced developer then you most probably worked with threads at some point of your career. As you’re now working with Unity, you most probably have forgotten about how the threads were once important to you. Unity as a game engine handles many things for you. It also introduces a functionality called Coroutines […]
Mobile Optimization – Unity Profiler
In the previous Mobile Optimization series post we talked about how important the batching is. We talked about how to use Unity Profiler in order to inspect how many batches are actually made. Now we will talk a little more about the Profiler itself. If you already know about it you may learn something new! The idea […]
Wrong Import Settings are Killing Your Unity Game [Part 1]
There are many things that may go wrong with your game development. Your models may have too much triangles than your target platform can handle, your algorithms may be too expensive for your CPU, and also you may be using too many materials so batching won’t work efficiently. These are difficult issues, and you as a […]
Mobile Optimization – Batching in Unity
Do you know what batching is? You may want to check out the Nvidia presentation Batch, Batch, Batch for some more details but long story short, batching the graphics data means to wrap it up into a single package and send it to the GPU in a single pass. Why does that matter to us? That’s […]
Unity 5.1 Assertion Library
There’s a great article by Yegor Bugayenko called Need Robust Software? Make It Fragile. It’s about Fail Fast philosophy where you should write your code in the way that your application will fail as fast as possible if something is significantly wrong with your data or environment. When you’re building a mobile game with Unity then most probably you’re […]
Accessing Your Unity Game Logs
Unity allows you to log variety of messages into the Console window by using Debug.Log() function family. I don’t think that I need to convince anyone about how useful the logs are. However, did you know that when you’ve already built your application, you still are able to access your game logs? Accessing logs from the editor First things first. […]
How to customize Unity script templates
When you’re creating a new script, Unity editor generates its contents and for C# script it uses the file name as the class name. It looks like this. using UnityEngine; using System.Collections; public class MyCustomScript : MonoBehaviour { // Use this for initialization void Start () { } // Update is called once per frame void Update […]
Rendering custom GUI on Scene view
If you’re using assets from the Asset Store then most probably you realized that some scripts introduce custom GUI elements inside the scene view. Custom GUI elements may be very helpful in many cases and they are also easy to implement! Today I’d like to show how to do this. First, you need to know when custom […]